Wondering about support for legacy Mysql tables in web2py. Read the book
section on legacy databases, but keep getting:
<type 'exceptions.SyntaxError'> keyed tables can only reference other keyed
tables (for now)
My mysql db and web2py models like something like this:
CREATE TABLE `car_models` (
`model_id` int(10) unsigned NOT NULL auto_increment,
`model_name` text NOT NULL,
PRIMARY KEY (`model_id`)
)
CREATE TABLE `cars` (
`car_id` int(10) unsigned NOT NULL auto_increment,
`model_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`car_id`)
)
web2py model:
x_db = DAL('mysql://user:password@db/database')
x_db.define_table('car_models',
Field('model_id','id'),
Field('model_name','string'),
migrate=False
)
x_db.define_table('cars',
Field('car_id','id'),
Field('model_id','reference car_models.model_id'),
Field('note','text'),
migrate=False
)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.