Hi!

Is it possible to force query to automatically expire instance's lazy
attributes? And I mean instances that were queried and accessed before
the "second" query?

Example:

mapper(MyObject, my_table, properties={
    "myattr": relation(ChildObject)
  })

following code will lead in only 3 SELECTs (because the attribute will
be in the identity map due to the first access)

... clean identity map ...
obj = sess.query(MyObject).first()
print obj.myattr
obj = sess.query(MyObject).first()
print obj.myattr # this will not do a new SELECT

I don't want to do something like:
objs = sess.query(MyObject).all()
for obj in objs:
    sess.expire(obj, "myattr")

Is there any query option so solve that or I have to use sess.expire?

Thanks.

David

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to