Chapter 12.1.3. Name Acrobatics
Names of class models and their attributes differ from the corresponding table names and column names in the DB. SQLObject uses a default naming scheme that basically generates a lowercase underscore-separated table name (for example, table_name) for a CamelCase class name (for example, TableName), so LazyBum becomes lazy_bum. You can override the naming scheme at different levels.
The following code for a Person model class results in a database table called person:
class Person(SQLObject): name = StringCol() Person.createTable(ifNotExists=True) CREATE TABLE person ( id INTEGER PRIMARY KEY, name TEXT );
If you want the table to be called people because you are sharing your database with a Rails application that ...
Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.