- fixed bug which could arise when using session.begin_nested() in conjunction
with more than one level deep of enclosing session.begin() statements
+ - fixed session.refresh() with instance that has custom entity_name
+ [ticket:914]
+
- dialects
- sqlite SLDate type will not erroneously render "microseconds" portion
self._validate_persistent(instance)
- if self.query(instance.__class__)._get(instance._instance_key, refresh_instance=instance._state, only_load_props=attribute_names) is None:
+ if self.query(_object_mapper(instance))._get(instance._instance_key, refresh_instance=instance._state, only_load_props=attribute_names) is None:
raise exceptions.InvalidRequestError("Could not refresh instance '%s'" % mapperutil.instance_str(instance))
def expire(self, instance, attribute_names=None):
assert address2.select().execute().fetchall() == [(a1.address_id, u2.user_id, 'a2@foo.com')]
ctx.current.clear()
- u1list = ctx.current.query(User, entity_name='user1').select()
- u2list = ctx.current.query(User, entity_name='user2').select()
+ u1list = ctx.current.query(User, entity_name='user1').all()
+ u2list = ctx.current.query(User, entity_name='user2').all()
assert len(u1list) == len(u2list) == 1
assert u1list[0] is not u2list[0]
assert len(u1list[0].addresses) == len(u2list[0].addresses) == 1
+ u1 = ctx.current.query(User, entity_name='user1').first()
+ ctx.current.refresh(u1)
+ ctx.current.expire(u1)
+
+
def testcascade(self):
"""same as testbasic but relies on session cascading"""
class User(object):pass