Previous topic

SQLObject Quick Guide

Next topic

SQLObject Caching

Avoiding SQL reserved words in the model definitionΒΆ

When naming classes or column attributes in your 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
  • User
  • password column in firebird.

To avoid this, you can either use a prefix (e.g. the TurboGears identity framework used to call the user class TG_User), 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: