On Jun 20, 2011, at 3:18 AM, Maciej Szumocki wrote: > On 17 Cze, 16:20, Michael Bayer <mike...@zzzcomputing.com> wrote: > >> I usually just turn expire_on_commit = False. But note also if you just >> want to do a get(), the actual PK is always present in the "key", which is >> instance_state(myinstance).key[1]. > > I do want rest of the attributes to expire, which makes > expire_on_commit = False not practical. > But i need (read-only) access to primary key attribute in another > thread, and a guarantee that this access won't result in any database > queries. > Can you perhaps suggest another solution?
as I mentioned, instance_state(myinstance).key[1] will give you the primary key. its generally safe to call from other threads unless you are changing the PK of the instance and flushing. -- 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.