New to web2py and I'm having trouble understanding some of the built in db
alter functionality. I have the following table design in a model called
db_structure.py:
# coding: utf8
db.define_table('dealers',
Field('name', length=75),
Field('address1', length=100),
Field('address2', length=100),
Field('city', length=100),
Field('st', length=100, label='State'),
Field('zip', length=12),
Field('phone', length=11),
redefine=True)
db.define_table('products',
Field('part_id', type='string', length=100),
Field('description', type='string', length=250),
Field('dealer_cost', 'float', default=0.00),
Field('msrp', 'float', default=0.00),
Field('dealer', db.dealers),
redefine=True)
In my db.py model I have the following for my DAL:
db =
DAL('mysql://dbuser:dbpassword@localhost/dbname',pool_size=1,check_reserved=['all'],migrate=True)
When I make changes to a table, I get errors such as this:
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 220, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/Blitz/models/db_structure.py"
<https://192.168.0.29/admin/default/edit/Blitz/models/db_structure.py>, line
17, in <module>
redefine=True)
File "/home/www-data/web2py/gluon/dal.py", line 8223, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "/home/www-data/web2py/gluon/dal.py", line 8260, in lazy_define_table
polymodel=polymodel)
File "/home/www-data/web2py/gluon/dal.py", line 1132, in create_table
fake_migrate=fake_migrate
File "/home/www-data/web2py/gluon/dal.py", line 1245, in migrate_table
self.execute(sub_query)
File "/home/www-data/web2py/gluon/dal.py", line 1969, in execute
return self.log_execute(*a, **b)
File "/home/www-data/web2py/gluon/dal.py", line 1963, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
File "/home/www-data/web2py/gluon/contrib/pymysql/cursors.py", line 117, in
execute
self.errorhandler(self, exc, value)
File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 202,
in defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1146, u"Table 'blitz.products' doesn't exist")
I'm sure I'm just over looking something, but I'm not sure what it is...
Any thoughts?
--
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/d/optout.