Hi, and here comes another problem with my project utilizing SQLAlchemy :).
I am trying to use ORM in AttributeExtension: (http://dpaste.com/109454/) ========================================================= import sqlalchemy import sqlalchemy.ext.declarative Base = sqlalchemy.ext.declarative.declarative_base(mapper = sqlalchemy.orm.mapper) engine = sqlalchemy.create_engine('sqlite:///:memory:', echo = False) session = sqlalchemy.orm.scoped_session(sqlalchemy.orm.sessionmaker(bind = engine)) Base.metadata.bind = engine class AttrEx(sqlalchemy.orm.interfaces.AttributeExtension): def set(self, state, value, oldvalue, initiator): for o in session.query(Foo): pass return value class Foo(Base): Id = sqlalchemy.Column( sqlalchemy.types.Integer, primary_key = True, autoincrement =True) __tablename__ = 'foo' class Bar(Base): Id = sqlalchemy.Column(sqlalchemy.types.Integer, primary_key=True, autoincrement = True) someAttr = sqlalchemy.orm.column_property(sqlalchemy.Column(sqlalchemy.types.Integer), extension = AttrEx()) __tablename__ = 'bar' Base.metadata.create_all() a = Bar() session.add(a) a.someAttr = 5 assert a.someAttr == 5 session.commit() assert a.someAttr == 5 ========================================================= Seccond assert explodes. It seems that query'ing in AttrEx's set() method triggers flush (autoflush which I need) and somehow value returned by set() gets lost. Is there a correct way to manipulate other mapped objects in AttributeExtensions? regards, Filip Zyznieski Tefnet --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---