Tuesday, March 3, 2009

Existing database tables and SQLObject

Define the existing table "Bookmark" as a class in python:-

class Bookmark(SQLObject):

_fromDatabase = True # the table structure will be loaded from the database
BookmarkName = StringCol (dbName="bookmark_name")
# dbName is the name of the column in the database, BookmarkName is the name reference in code.
ProjectId = IntCol(dbName="project_id")

(Make sure the indentation is correct)

No comments: