Hi,
I am trying the following:
import sqlalchemy as sqa
from sqlalchemy import orm
engine = sqa.create_engine("sqlite://", echo=True)
meta = sqa.MetaData(bind=engine)
Session = orm.scoped_session(orm.sessionmaker(bind=engine,
autocommit=True,autoflush=False))
tab = sqa.Table("test", meta,
sqa.Column("poly", sqa.Integer),
sqa.Column("id", sqa.Integer, primary_key=True),
sqa.Column("parent", sqa.Integer, sqa.ForeignKey("test.id")),
sqa.Column("other", sqa.Integer, sqa.ForeignKey("test.id")),
)
meta.create_all()
class C1(object):
pass
class C2(C1):
pass
Session.mapper(C1, tab, polymorphic_on=tab.c.poly, polymorphic_identity=0,
properties={
"children": orm.relation(C2, primaryjoin=tab.c.parent==tab.c.id),
})
Session.mapper(C2, inherits=C1, polymorphic_identity=1)
print C1.query.filter(C1.children.any()).all()
the print statement gives me
AttributeError: 'ClauseList' object has no attribute 'proxy_set'
Where am I wrong?
--
Jazz is not dead, it just smells funny (FZ)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---