It sure is SQLObjects fault.

This works for me in mysql:

SELECT * FROM `select` WHERE `select`.id > 100;

And this is how SQLObject should really quote its tables and fields.

--
Sebastjan
http://www.trepca.si/blog


On 4/10/06, Ed Singleton <[EMAIL PROTECTED]> wrote:
>
> On 10/04/06, Alberto Valverde <[EMAIL PROTECTED]> wrote:
> >
> >
> > 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,
>
> It does, thank you.  (I should have been able to work that out for
> myself.  I knew you could specify table names, but that hadn't
> clicked).
>
> Thank you
>
> Ed
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to