[storm] Overriding database column for Storm subclass property?
James Henstridge
james at jamesh.id.au
Mon Jul 7 08:41:18 BST 2008
On Mon, Jul 7, 2008 at 1:33 PM, Justin Warren <daedalus at eigenmagic.com> wrote:
> Hi folks,
>
> I'm new to Storm, by way of Twisted, and so far I like what I see! I
> look forward to playing more with DeferredStore sometime soon.
>
> My question: When defining a Storm subclass, is it possible to define
> the database column to use for the Property, rather than having it
> automagically use the name of the class attribute? Something like the
> following syntax (which doesn't work):
>
> class Person(Storm):
> """
> My Person class, linked to an existing database schema
> """
> id = Int()
> name = Unicode()
> # I want to use Person.surname, not Person.person_lastname
> surname = Unicode(column='person_lastname')
The following should do what you want:
surname = Unicode('person_lastname')
James.
More information about the storm
mailing list