Hi ,
I'm new to SQLObject so my question would be probably stupid... ;)
I'm trying to do a foreign key to the same table but I've got an error
Here's an example:
class NestedTest(SQLObject):
attr1 = StringCol()
attr2 = StringCol()
parent = ForeignKey('NestedTest')
#NestedTest.createTable()
NestedTest.sqlmeta.addJoin(MultipleJoin('NestedTest',joinMethodName='childs'))
n1=NestedTest(attr1='first', attr2='55408',parent=None)
n2=NestedTest(attr1='second', attr2='55409', parent=n1)
n3=NestedTest(attr1='third', attr2='55410', parent=n1)
print n2.childs
TRACEBACK#######################
Traceback (most recent call last):
File
"/Applications/eclipse/plugins/org.python.pydev.debug_1.3.17/pysrc/pydevd.py",
line 852, in <module>
debugger.run(setup['file'], None, None)
File
"/Applications/eclipse/plugins/org.python.pydev.debug_1.3.17/pysrc/pydevd.py",
line 689, in run
execfile(file, globals, locals) #execute the script
File
"/Users/dimiduj/Sites/Sites/pythonProjects/ackobots/src/sqlO/__init__.py",
line 49, in <module>
print n1.childs
File "<string>", line 1, in <lambda>
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/joins.py",
line 144, in performJoin
inst.id)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 537, in _SO_selectJoin
self.sqlrepr(value)))
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 350, in queryAll
return self._runWithConnection(self._queryAll, s)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 250, in _runWithConnection
val = meth(conn, *args)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 343, in _queryAll
self._executeRetry(conn, c, s)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/mysql/mysqlconnection.py",
line 119, in _executeRetry
raise OperationalError(ErrorMessage(e))
sqlobject.dberrors.OperationalError: Unknown column 'nested_test_id' in
'where clause'
Exception exceptions.AttributeError: "'NoneType' object has no attribute
'print_exc'" in <function _removeReceiver at 0x12214f0> ignored
#####################################
I've seen these two thread :
- http://thread.gmane.org/gmane.comp.python.sqlobject/3135
- http://article.gmane.org/gmane.comp.python.sqlobject/9211/match=nested
But there is no clear answer
What I'm doing wrong ?
Is this impossible with SQLObject?
Any help would be appreciate
Thx
Dimitri
-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss