Hi, I've been designing a new model this morning and I ran into a bug
or a misconception on my part.
Here is my very simple model to illustrate the problem:
from sqlobject import *
from turbogears.database import PackageHub
# Uncomment the following line if you wish to use Identity and
SO_Provider
#from turbogears.identity.soprovider import TG_User, TG_Group,
TG_Permission
hub = PackageHub("enigmacurryblog")
__connection__ = hub
class Group(SQLObject):
stuff = StringCol(length=10)
When I do a "tg-admin sql create" I get the following traceback:
Using database URI
sqlite:///airlock/subversion/blog/EnigmaCurryBlog/enigmacurry.sqlite
Traceback (most recent call last):
File "/usr/local/bin/tg-admin", line 7, in ?
sys.exit(
File
"/usr/lib64/python2.4/site-packages/TurboGears-0.9a1-py2.4.egg/turbogears/command
/base.py", line 270, in main
command.run()
File
"/usr/lib64/python2.4/site-packages/TurboGears-0.9a1-py2.4.egg/turbogears/command
/base.py", line 129, in run
command.the_runner.run(sys.argv)
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
manager/command.py", line 102, in run
runner.run()
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
manager/command.py", line 233, in run
self.command()
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
manager/command.py", line 569, in command
soClass.createTable()
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
main.py", line 1322, in createTable
conn.createTable(cls)
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
dbconnection.py", line 522, in createTable
self.query(self.createTableSQL(soClass))
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
dbconnection.py", line 303, in query
return self._runWithConnection(self._query, s)
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
dbconnection.py", line 217, in _runWithConnection
val = meth(conn, *args)
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
dbconnection.py", line 300, in _query
self._executeRetry(conn, conn.cursor(), s)
File
"/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/
dbconnection.py", line 295, in _executeRetry
return cursor.execute(query)
pysqlite2.dbapi2.OperationalError: near "group": syntax error
If I rename my class from Group to something else I get no error. Is
the word Group reserved somehow? I haven't tested another database
server yet as it does appear to be sqlite that is producing the final
error.
If Group is reserved somehow it would be nice if there were a pre-parse
step to "tg-admin sql create" that created a better error message.
Also, maybe we put a warning in ModelDesigner too of class names people
can't use.
Using Turbogears 0.9a1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---