Hi,
I'm trying to declare a adjacency list as follow:
class CourseSet(AbstractContainer):
parent_id = Column('PARENT_COURSE_SET', Integer,
ForeignKey('CM_MEMBER_CONTAINER_T.ENTERPRISE_ID'))
children = relationship("CourseSet", backref=backref('parent',
remote_side=AbstractNamed.eid))
@classproperty
def __mapper_args__(self):
args = dict()
args.update(AbstractContainer.__mapper_args__)
args.update({'polymorphic_identity':
'org.sakaiproject.coursemanagement.impl.CourseSetCmImpl'})
return args
But I couldn't succeed, i've the following error message:
sqlalchemy.exc.ArgumentError: Relationship CourseSet.parent could not
determine any local/remote column pairs from remote side argument
set([Column('ENTERPRISE_ID', String(length=255, convert_unicode=False,
assert_unicode=None, unicode_error=None,
_warn_on_bytestring=False), )])
I've tried to use
http://www.sqlalchemy.org/docs/orm/relationships.html#adjacency-list-relationships
but with no success. The only "not-classical" thing is the use of
AbstractNamed.eid (a field from a parent class), is there an impact ?
Cheers,
Julien.
PS: other parent objects:
class AbstractPersistent(object):
version = Column('VERSION', Integer)
last_modified_by = Column('LAST_MODIFIED_BY', String(255))
last_modified_date = Column('LAST_MODIFIED_DATE', Date)
created_by = Column('CREATED_BY', String(255))
created_date = Column('CREATED_DATE', Date)
def __repr__(self):
return "<AbstractPersistent('%s','%s', '%s','%s','%s')>" % \
(self.version, self.last_modified_by,
self.last_modified_date,
self.created_by, self.created_date)
class AbstractNamed(AbstractPersistent):
eid = Column('ENTERPRISE_ID', String(255))
title = Column('TITLE', String(255))
description = Column('DESCRIPTION', String(255))
def __repr__(self):
return "<AbstractNamed('%s','%s', '%s')>" % \
(self.eid, self.title, self.description) + \
super(AbstractNamed, self).__repr__()
class AbstractContainer(Base,AbstractNamed):
__tablename__ = 'CM_MEMBER_CONTAINER_T'
id = Column('MEMBER_CONTAINER_ID',Integer,primary_key=True)
discriminator = Column('CLASS_DISCR', String(100))
__mapper_args__ = {'polymorphic_on': discriminator }
--
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.