When naming classes for 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
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:
- Mailing list: do NOT use Group or Order as SQLObject classes
- SQLObject sqlmeta documentation use sqlmeta's table attribute to override how a table is named
- MySQL reserved words