wiki:SQLObjectReservedWords
Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 2 (modified by tlesher@…, 13 years ago) (diff)

Added example using sqlmeta

When naming classes for you model, using names that are reserved words in SQL, such as "Group" or "Order", will cause an SQL syntax error during table creation.

Reserved words that commonly cause errors:

  • Order
  • Group
  • Option

To avoid this, you can either use a prefix (like TG_Group in the TurboGears identity framework), or else use an "sqlmeta" inner class in your model object:

class Group(SQLObject):
    class sqlmeta:
        table=app_group

This way, your model object's name can still be (for example) "Group", but the table name SQLObject uses will be "app_group".

More information: