12 Aug 18:14
Inheritance and MultipleJoin
From: Luis Javier Peris <javierperis <at> gmail.com>
Subject: Inheritance and MultipleJoin
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-08-12 16:18:39 GMT
Subject: Inheritance and MultipleJoin
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-08-12 16:18:39 GMT
I'd like to know if there is a restriction using inheritance about multiplejoin function because I'm getting an error and I don't know why. I've the following code:
class Question(InheritableSQLObject):
filename = StringCol(default=None, length=255, unique=True)
title = StringCol(default=None)
default_mark = FloatCol(default=0.0)
wording = RelatedJoin('Content')
term_questions = RelatedJoin('Term', joinColumn='term', otherColumn='question',
intermediateTable='Term_questions')
answers = MultipleJoin('Answer')
questionref = MultipleJoin('QuestionRef')
class Answer(SQLObject):
value = StringCol(default=None)
calification = FloatCol(default=None)
ide = StringCol(default=None)
question = ForeignKey('Question')
class Ord(Question):
_inheritable = False
shuffle = BoolCol()
orderanswers = MultipleJoin('OrderChoice')
class OrderChoice(SQLObject):
value = StringCol(default=None)
ord = IntCol(default=None)
ide = StringCol(default=None)
question = ForeignKey('Ord')
and when I've a Ord instance (called 'q') and I do 'q.orderanswers' I get the following error:
sqlobject.dberrors.OperationalError: Unknown column 'ord_id' in 'where clause'
Any idea?
Thanks!!
class Question(InheritableSQLObject):
filename = StringCol(default=None, length=255, unique=True)
title = StringCol(default=None)
default_mark = FloatCol(default=0.0)
wording = RelatedJoin('Content')
term_questions = RelatedJoin('Term', joinColumn='term', otherColumn='question',
intermediateTable='Term_questions')
answers = MultipleJoin('Answer')
questionref = MultipleJoin('QuestionRef')
class Answer(SQLObject):
value = StringCol(default=None)
calification = FloatCol(default=None)
ide = StringCol(default=None)
question = ForeignKey('Question')
class Ord(Question):
_inheritable = False
shuffle = BoolCol()
orderanswers = MultipleJoin('OrderChoice')
class OrderChoice(SQLObject):
value = StringCol(default=None)
ord = IntCol(default=None)
ide = StringCol(default=None)
question = ForeignKey('Ord')
and when I've a Ord instance (called 'q') and I do 'q.orderanswers' I get the following error:
sqlobject.dberrors.OperationalError: Unknown column 'ord_id' in 'where clause'
Any idea?
Thanks!!
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ sqlobject-discuss mailing list sqlobject-discuss <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

RSS Feed