Dear SQLAlchemy users,

I'm playing with inheritance for a CMS-like application. It's very
usefull as it greatly simplifies the code.

Here is my SQL script http://pastebin.com/f7c5297c8 and here is my
python code (mappers, etc) http://pastebin.com/f1e2738ba
(Not everything is shown...)

As you can see, everything inherits from a "Content". "Folder" are
special "Content" which act as containers for one or more "Content"
through the "FolderContent" object (folder_content table).

The problem is at line 128 of the second paste, SQLAlchemy is unable to
determine the join condition to the "Folder" ("folder" table) which
seems strange because folder_content table has explicitely a foreign key
to the "folder" table (line 70 of the first paste).

When I try to get a specific FolderContent through :
>>> model.FolderContent.query.get((12,6))

I get a:

"ArgumentError: Could not determine join condition between parent/child
tables on relation FolderContent.folder.  Specify a 'primaryjoin'
expression.  If this is a many-to-many relation, 'secondaryjoin' is
needed as well."

My question is: do I need to explicitely specify the join condition when
inheritance is involved ? Why is SQLAlchemy able to detect the join
condition for my "Content" (line 127) but not for my "Folder" (line
128) ?

In advance thanks for your answers

Best regards,
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 sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to