Hi,
I´ve just using sqlalchemy 0.5.1 with python 2.6 and turbogers, but I
found a little problem trying to configurate adjacency relationship
with declarative base.
My object class is something like this:
class QueryGroup(DeclarativeBase):
__tablename__ = 'queries_group'
qry_grp_id = Column(Smallinteger, primary_key=True)
qry_grp_desc = Column(Unicode(20), nullable=False)
parent_id = relation('QueryGroup', backref='parent')
When I try to generate my tables, I get an error like this:
sqlalchemy.exc.ArgumentError: Could not determine join condition
between parent/
child tables on relation QueryGroup.parent_id. Specify a
'primaryjoin' expressi
on. If this is a many-to-many relation, 'secondaryjoin' is needed as
well.
How can I specify the correct statement?
Using traditional mapper approach, I can do:
queries_group = Table(...)
mapper(QueryGroup, queries_group, properties={
'children': relation(QueryGroup, cascade="all",
backref=backref("parent", remote_side=
[queries_group.c.qry_grp_id]))
}
)
Can I do the same using declarative style? How?
Thanks in advance.
---
Maxi.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---