On Jun 17, 2011, at 2:19 AM, Maciej Szumocki wrote: > Hi all, > > I have a question for SA 0.7. Is there a way to prevent expiration of > some of the attributes of a mapped object > (without detaching the object from session). I have a use case where > primary keys are immutable (they're only > INSERTed, never UPDATEd), and i'd like to able to always access them > without potientally triggering a refresh > (in other words, those attributes should be available if objects were > loaded even if database connection goes away). > I was able to achieve that in 0.6 and earlier with lots of > monkeypatching, but can't seem to find a way to do the > same in 0.7.
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]. -- 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.