-
Notifications
You must be signed in to change notification settings - Fork 27
Models
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.
Schemas are actual SQL table definitions found in sql/models.sql
. (There are some updates in sql/migrations/
)
Object modeling happens in multiple files in the giveaminute/
directory. There is a file for each major object.
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()
.