Look at you model definition... db.define_table('user', Field('email','string',length=50), Field('name','string',length=50), migrate=True )
If you omit premary key the PK will be id as an integer. You should use the default instead of keyed table... migrate=False prevent web2py to create for you your defined table into whatever backend dbms (Postgres, MySQL, Squlite) Omit or migrate=True Try Richard On Tue, Dec 14, 2010 at 11:04 AM, Hybride <mshybr...@gmail.com> wrote: > Hi everyone, > > Am sorry for such a ridiculous question, but how does one go about > actually initiating/dealing with database tables in web2py? I use the > default SQLite3 that comes with web2py, but would not have an issue > actually changing over to MySQL. Is there any chance someone can point > me in the right direction to a document on how to create the tables in > web2py? > > I have, for example, this table in my db.py controller: > > db.define_table('User', > Field('Email','string',50), > Field('Name','string',50), > primarykey=['Email'], > migrate=False > ) > > Where do I go from here? And if I have multiple define_tables in my > db.py, all of them should be created? I've tried copying the examples > given in web2py (the one about how many animals/dogs one has, etc), > but could not replicate the results.