I have a situation similar to
http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_inheritance_single
with the exception that I have about 50 different types, but only one of
them I want to subclass. So I was wondering id there was some option to
polymorphic_identity to give it a list of values.
Currently what I do is I map the subclass against a query:
sql_file_node = select ([nodehierarchy_table],
asset_table.c.type=='file').alias ('file_node_query')
mapper(Node, nodehierarchy_table .....)
mapper(FileNode, sql_file_node......)
what I would like to do:
node_mapper = mapper(Node, nodehierarchy_table,
polymorphic_on=nodehierarchy_table.c.type, ....)
mapper(FileNode, inherits=node_mapper,
polymorphic_on=asset_table.c.type, polymorphic_identity='file' ....)
However when I do this, SA complains that there "AssertionError: No such
polymorphic_identity '<any other type>' is defined"
To complicate matters slightely this is a self referential table,
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/basic_tree.py
This isn't a huge problem because I could continue to use SA the way I
currently am.
--
David Gardner
Pipeline Tools Programmer, "Sid the Science Kid"
Jim Henson Creature Shop
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---