See examples in sqlalchemy named dictlike.py und another 2 .

here there are for example
http://www.google.com/codesearch/p?hl=en#lIxjJFXSjns/trunk/code/prereq/SQLAlchemy-0.4.8/examples/vertical/dictlike.py&q=VerticalPropertyDictMixin&sa=N&cd=1&ct=rc

On Wed, Dec 2, 2009 at 10:30 AM, Sergey V. <sergey.volob...@gmail.com>wrote:

> Hi all,
>
> I've got two tables: Users (id, password) and UserProperties (user_id,
> name, value). Is there a way to map the properties stored in
> UserProperties as attributes of User object?
>
> I mean,
>
> john = User('john', 'password')
> john.name = "John Smith" # creates UserProperty('john', 'name', 'John
> Smith')
>
> The set of possible attributes is fixed so I don't mind hard-wiring
> them to the User object one by one, something like that:
>
> class User(...):
>   ...
>   name = some_magic_function(UserProperty, 'name')
>   address = some_magic_function(UserProperty, 'address')
>
> I've read on association_proxy but couldn't figure out how to use it
> in this case.
>
> Thanks,
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com<sqlalchemy%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to