Is this legal? The field "title" is exposed in one polymorphic subclass
as the attribute "file_name" and in another as "name".
<code>
class _Doc(Base):
""" An OpenGroupare Document object """
__tablename__ = 'doc'
object_id = Column("document_id",
Integer,
Sequence('key_generator'),
primary_key=True)
....
_is_folder = Column("is_folder", Integer)
__mapper_args__ = {'polymorphic_on': _is_folder}
class Document(_Doc):
__entityName__ = 'File'
__mapper_args__ = {'polymorphic_identity': 0}
file_name = Column("title", String(255))
class Folder(_Doc):
__entityName__ = 'Folder'
__mapper_args__ = {'polymorphic_identity': 1}
name = Column("title", String(255))
</code>
When I run this as "python app.py" it works. However if I install the
Egg and run app.py it fails with the error -
<error>
Traceback (most recent call last):
File "/usr/bin/coils-master-service", line 5, in <module>
pkg_resources.run_script('OpenGroupware==0.1.16',
'coils-master-service')
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 448, in
run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1173,
in run_script
exec script_code in namespace, namespace
File
"/usr/lib/python2.6/site-packages/OpenGroupware-0.1.16-py2.6.egg/EGG-INFO/scripts/coils-master-service",
line 23, in <module>
File "build/bdist.linux-x86_64/egg/coils/foundation/__init__.py", line
24, in <module>
File
"build/bdist.linux-x86_64/egg/coils/foundation/alchemy/__init__.py",
line 28, in <module>
File "build/bdist.linux-x86_64/egg/coils/foundation/alchemy/doc.py",
line 206, in <module>
File
"/usr/lib/python2.6/site-packages/SQLAlchemy-0.6.1-py2.6.egg/sqlalchemy/ext/declarative.py",
line 830, in __init__
_as_declarative(cls, classname, cls.__dict__)
File
"/usr/lib/python2.6/site-packages/SQLAlchemy-0.6.1-py2.6.egg/sqlalchemy/ext/declarative.py",
line 806, in _as_declarative
(c, cls, inherited_table.c[c.name])
sqlalchemy.exc.ArgumentError: Column 'title' on class <class
'coils.foundation.alchemy.doc.Folder'> conflicts with existing column
'doc.title'
</error>
--
Adam Tauno Williams <[email protected]> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba
--
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.