[Twisted-Python] autoincrement in axiom
mithrandi at mithrandi.net
Sun Feb 28 19:27:40 EST 2010
On Mon, Mar 1, 2010 at 1:31 AM, code prophecy <codeprophecy1 at gmail.com> wrote:
> Is there a way to use autoincrement in axiom ? I need a property in my model
> that reflects the last row id after every insert operation.
There isn't currently any way to have an autoincrement attribute.
However, the storeID attribute is unique across every Item in a Store;
perhaps this is sufficient for your purposes?
> Also, is it
> safe to use non-db variables in axiom model ? something like
> class test1(Item):
> name = attributes.text()
> surname = "my non db variable"
> The interpretor does throw an error but that can be overcome by using
> self.__dict__['surname'] = "non db" . Just wanted to know if this is
> recommended or not
You should declare the attribute like this:
surname = attributes.inmemory()
Axiom will then allow you to set the attribute, which will not be
persisted in the database.
mithrandi, i Ainil en-Balandor, a faer Ambar
More information about the Twisted-Python