On 10/04/2006, at 11:41, Ed Singleton wrote:
>
> I kept getting the following error with my model:
>
> File "C:\Python24\lib\site-packages\MySQLdb\connections.py", line
> 33, in defau
> lterrorhandler
> raise errorclass, errorvalue
> _mysql_exceptions.ProgrammingError: (1064, "You have an error in
> your SQL syntax
> ; check the manual that corresponds to your MySQL server version
> for the right s
> yntax to use near 'group' at line 1")
>
>
> After reducing my code to the minimum that produced the problem, I
> discovered that creating a class in my model called "Group" was what
> produced the error.
>
> Is there any straightforward way round this or if not, is there a list
> of words I can't use as class names in my model?
This isn't SQLObejct's fault but SQL's... "GROUP" is a reserved SQL
keyword (GROUP BY colname) hence a class called "Group" will map to a
table called "group".
You can, however, work around it by defining a "table" attribute in
sqlmeta:
class Group(SQLObject):
class sqlmeta:
table = "group_table"
Hope it helps,
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---