Skip to content
zzolo edited this page Aug 17, 2011 · 10 revisions

Models (database objects, schemas, mapping) are sadly in flux. But the flux is towards using SQLAlchemy.

Old Modeling

Schema

Schemas are actual SQL table definitions found in sql/models.sql. (There are some updates in sql/migrations/)

Object Modeling

Object modeling happens in multiple files in the giveaminute/ directory. There is a file for each major object.

Querying

Querying is done with web.py's database methods. For instance:

sql = 'select * from user where user_id = $userId'
data = db.query(sql, { 'userId': some_id })

The db object is created in the base controller (framework/controller.py) which is passed around, or retrieved with Controller.get_db().

New Modeling

Clone this wiki locally