Hi,
I recently upgraded my system from SA 0.3.11 to 0.5.8, and I found
that the behaviour for expiring instances has changed in terms of how
much data gets retrieved upon attribute access. For instance,
# One User can have many groups
mapper(User, user_tbl, properties={'groups':relation(Group,
John Huang wrote:
Hi,
I recently upgraded my system from SA 0.3.11 to 0.5.8, and I found
that the behaviour for expiring instances has changed in terms of how
much data gets retrieved upon attribute access. For instance,
# One User can have many groups
mapper(User, user_tbl,
Michael,
Thanks for the quick response.
On Apr 5, 12:39 pm, Michael Bayer mike...@zzzcomputing.com wrote:
you can certainly expire specific attributes by passing a list of their
names to expire:
sess.expire(inst, ['foo', 'bar', 'bat'])
in modern versions of SQLAlchemy calling
John Huang wrote:
Now I understand that refresh will cause a reload of all attributes
based the primary mapper. However, the reason that I want to use
expire instead of refresh is because there may be places in my code
where the same object will be expired multiple times before an
attribute
Michael Bayer wrote:
John Huang wrote:
Now I understand that refresh will cause a reload of all attributes
based the primary mapper. However, the reason that I want to use
expire instead of refresh is because there may be places in my code
where the same object will be expired multiple times
Thanks for your help and insight, Michael!
For now, since my program was using SA 0.3, it only deals with
instance-wide expiration, so for now I have just wrapped the
AttributeImpl.get method to do a full refresh of the instance if its
state is expired.
On Apr 5, 3:47 pm, Michael Bayer
Here's what I'd like to do. Suppose I have some class Foo in
some_module.py:
class Foo(Entity):
def all_foos(self):
return self.session.query(Foo).all()
...sqlalchemy by default will log this to sqlalchemy.engine. However,
this makes it a bit difficult to narrow down
Jason Baker wrote:
Here's what I'd like to do. Suppose I have some class Foo in
some_module.py:
class Foo(Entity):
def all_foos(self):
return self.session.query(Foo).all()
...sqlalchemy by default will log this to sqlalchemy.engine. However,
this makes it a bit