Hi All,
I am very new to web2py and in general to web framework.
I am trying to read a db content from a remote machine, db is mysql, web2py
version 1.99.7 stable.
I have created a new simple application and added a model db1.py with:
legacy_db = DAL('mysql://username:password@my_server:3306/timesheet',
migrate_enabled=False, pool_size=20)
legacy_db.define_table('timesheet_client',
Field('client_id', 'integer'),
Field('organisation', 'string'),
Field('description', 'string'),
Field('address1', 'string'),
Field('city', 'string'),
Field('state', 'string'),
Field('country', 'string'),
Field('postal_code', 'string'),
Field('contact_first_name', 'string'),
Field('contact_last_name', 'string'),
Field('username', 'string'),
Field('contact_email', 'string'),
Field('phone_number', 'string'),
Field('fax_number', 'string'),
Field('gsm_number', 'string'),
Field('http_url', 'string'),
Field('address2', 'string'),
migrate=False)
then I added to controller default.py:
def index():
return locals()
def client():
clients =
legacy_db(legacy_db.timesheet_client).select(orderby=legacy_db.timesheet_client.client_id)
return locals()
When I look at page ../my_application/default/client I receive an error:
<class 'gluon.contrib.pymysql.err.InternalError'> (1054, u"Unknown column
'timesheet_client.id' in 'field list'")
but I do not have any timesheet_client.id filed in my legacy_db
Any suggestions?
--