if joined table inheritance can't figure out the join condition between the two tables, use the "inherit_condition" argument to mapper() which works similarly to primaryjoin on relation().
Julien Cigar wrote: > > Hello, > > I'm playing with inheritance for a project. The idea is that I have a > Content which is the mother class for every contents. Folder is a > Content, and Content are contained in Folder. Here are my DDL > statements : http://rafb.net/p/0JX0G778.html and my mappers are defined > here : http://rafb.net/p/sN9BrW16.html > (it's simplified for readability) > > SQLAlchemy gives me the following error : > > File '/home/jcigar/public_html/bbpf/bbpf/model/__init__.py', line 207 in > <module> > polymorphic_identity=_get_type_id('folder') > File > '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/orm/scoping.py', > line 74 in mapper > return mapper(*args, **kwargs) > File > '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/orm/__init__.py', > line 752 in mapper > return Mapper(class_, local_table, *args, **params) > File > '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/orm/mapper.py', > line 195 in __init__ > self._configure_inheritance() > File > '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/orm/mapper.py', > line 240 in _configure_inheritance > self.inherit_condition = > sqlutil.join_condition(self.inherits.local_table, self.local_table) > File > '/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/sql/util.py', > line 135 in join_condition > "join explicitly." % (a.description, b.description)) > ArgumentError: Can't determine join between 'content' and 'folder'; > tables have more than one foreign key constraint relationship between > them. Please specify the 'onclause' of this join explicitly. > > Any idea what could be wrong ? Where should I put this "onclause" > parameters in my Mapper for my Folder ? > > thanks, > Julien > > -- > Julien Cigar > Belgian Biodiversity Platform > http://www.biodiversity.be > Université Libre de Bruxelles (ULB) > Campus de la Plaine CP 257 > Bâtiment NO, Bureau 4 N4 115C (Niveau 4) > Boulevard du Triomphe, entrée ULB 2 > B-1050 Bruxelles > Mail: [email protected] > @biobel: http://biobel.biodiversity.be/person/show/471 > Tel : 02 650 57 52 > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
