[gtkmvc-users] Problems using SQLObjectModel
Brought to you by:
cavada
From: jon l. <mo...@ca...> - 2010-09-20 16:23:54
|
Hi, I'm new to this fantastic framework. First of all, thanks for creating it! It's very usefull! Now, going to the subject, I can't use the SQLObjectModel. I'm very interested in using it and have beeing playing with the example code found in python-gtkmvc-1.99.0/examples/sqlobject/ If I launch it without any changes it runs OK. But it doesn't create the sqlite database. Ok, i check the code and edit it so it looks like: .... __connection__ = "sqlite:///tmp/person" # ---------------------------------------------------------------------- class Person(SQLObjectModel): _connection = __connection__ fname = StringCol() mi = StringCol(length=1, default=None) lname = StringCol() .... Now it creates the database but fails to run. It throws the following error: ---------------------------------------------------------------------- $ python basic.py Traceback (most recent call last): File "basic.py", line 39, in <module> p = Person(fname="John", lname="Doe") File "/usr/lib/pymodules/python2.6/gtkmvc/model.py", line 490, in __init__ InheritableSQLObject.__init__(self, *args, **kargs) File "/usr/lib/pymodules/python2.6/sqlobject/main.py", line 1223, in __init__ self._create(id, **kw) File "/usr/lib/pymodules/python2.6/sqlobject/inheritance/__init__.py", line 384, in _create connection=self._connection) File "/usr/lib/pymodules/python2.6/gtkmvc/model.py", line 490, in __init__ InheritableSQLObject.__init__(self, *args, **kargs) File "/usr/lib/pymodules/python2.6/sqlobject/main.py", line 1223, in __init__ self._create(id, **kw) File "/usr/lib/pymodules/python2.6/sqlobject/inheritance/__init__.py", line 391, in _create super(InheritableSQLObject, self)._create(id, **kw) File "/usr/lib/pymodules/python2.6/sqlobject/main.py", line 1271, in _create self._SO_finishCreate(id) File "/usr/lib/pymodules/python2.6/sqlobject/main.py", line 1295, in _SO_finishCreate id, names, values) File "/usr/lib/pymodules/python2.6/sqlobject/dbconnection.py", line 403, in queryInsertID return self._runWithConnection(self._queryInsertID, soInstance, id, names, values) File "/usr/lib/pymodules/python2.6/sqlobject/dbconnection.py", line 262, in _runWithConnection val = meth(conn, *args) File "/usr/lib/pymodules/python2.6/sqlobject/sqlite/sqliteconnection.py", line 220, in _queryInsertID self._executeRetry(conn, c, q) File "/usr/lib/pymodules/python2.6/sqlobject/sqlite/sqliteconnection.py", line 186, in _executeRetry raise OperationalError(ErrorMessage(e)) sqlobject.dberrors.OperationalError: no such table: sql_object_model ---------------------------------------------------------------------- In debug mode I can see that it fails to check for sql_object_model table in the database (it doesn't exits). I have tryed with mysql with similar results. What I'm doing wrong? Thanks in advance. |