try use migrate=false to fit into legacy db. otherwise, it will try to 
create it. (pls refer to official doc on section: dal -> legacy db)
(one more hit that may not be related to this issue: define_table will 
create an id column automatically.)

在 2011年12月21日星期三UTC+8下午6时23分56秒,Axel写道:
>
> Hi,
>
> I have just started with web2py, setting up a simple page with MySQL.
>
> In db.py I added/changed the following:
> db = DAL('mysql://root:xxxxxxx@localhost:3306/test')
>
> db.define_table('testdata',Field('idtestdata'),Field('nyckel'),Field('data'))
>
> But when accessing the app I get an error ticket:
> Ticket ID
> 127.0.0.1.2011-12-21.11-11-59.27d5caca-b9cf-4f73-b3e7-4a7a61318e19
> <class 'gluon.contrib.pymysql.err.InternalError'> (1060, u"Duplicate 
> column name 
> 'nyckel'")
>
> Shouldn't define_table create or just use the table which is already 
> present in 
> the database?
>
> Any suggestions are welcome.
>
> Regards,
> Axel
>
>

Reply via email to