On Jun 17, 10:14 am, "allen.fowler" <allen.fow...@yahoo.com> wrote:
> > 3) Can this relation's objects be made "read-only"? That is:
> > "u.room = new_room" would work, but this would not: "u.room.name =
> > 'kitchen'"
>
> To clarify the question:
>
> Can this objects seen via this relation be made "read-only"? That is:
>
> u.room = a_room
> u.room = a_new_room
> ...would work fine.
>
> And this would work, too:
> r = session.query(u.room).one()
> r.name = "kitchen"
>
> But, this would not:
> u.room.name = 'kitchen'
you can, you can use a validator that rejects all changes, or if
you're
brave you can create a custom __setattribute__ method that brokers all
attribute setter access. the former is in the SQLA mapping docs the
latter is part of Python.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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
-~----------~----~----~----~------~----~------~--~---