Hi all, I have been trying to resolve an error that appears when I try to do
the following:
------------------------------------------------------------------------------------------------
from sqlobject import *
connection_string = 'mysql://root:[EMAIL PROTECTED]/kway'
connection = connectionForURI(connection_string)
sqlhub.processConnection = connection
class Contact(SQLObject):
name=StringCol()
surname=StringCol()
class Person(SQLObject):
name=StringCol()
surname=StringCol()
tel=StringCol(default=None)
mobile=StringCol(default=None)
fax=StringCol(default=None)
email=StringCol(default=None)
father=StringCol(default=None)
mother=StringCol(default=None)
adt=StringCol(default=None)
afm=StringCol(default=None)
contact=ForeignKey('Contact')
class Address(SQLObject):
street=StringCol()
number=StringCol()
city=StringCol()
zip=StringCol(default=None)
person=ForeignKey('Person')
--------------------------------------------------------------------------------------------------------------------------------
When I try Contact.createTable() everything is OK.
But when I subsequently try Person.createTable() I get the following error
(the same happens with Address.createTable() :
Traceback (most recent call last):
File "<input>", line 1, in ?
File "c:\python24\lib\site-packages\SQLObject-
0.8.0-py2.4.egg\sqlobject\main.py", line 1394, in createTable
conn.query(constraint)
File "c:\python24\lib\site-packages\SQLObject-
0.8.0-py2.4.egg\sqlobject\dbconnection.py", line 316, in query
return self._runWithConnection(self._query, s)
File "c:\python24\lib\site-packages\SQLObject-
0.8.0-py2.4.egg\sqlobject\dbconnection.py", line 230, in _runWithConnection
val = meth(conn, *args)
File "c:\python24\lib\site-packages\SQLObject-
0.8.0-py2.4.egg\sqlobject\dbconnection.py", line 313, in _query
self._executeRetry(conn, conn.cursor(), s)
File "c:\python24\lib\site-packages\SQLObject-
0.8.0-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 109, in
_executeRetry
raise OperationalError(ErrorMessage(e))
OperationalError: Can't create table 'kway.#sql-28c_4' (errno: 150)
But when I check the created tables, I find out that the tables are actually
created.
After some investigation, I found out that this is due to the ForeignKey
declaration (If I comment it out, the error doesn't appear).
I have tried a lot to resolve this error to no avail. Any help will be
greatly appreciated!!!!
(I am running winXP sp2, mysql5.1.16b, python2.4 and SQLObject 0.8.0)
thanks,
Nik
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss