Import from MySQL

31 views
Skip to first unread message

Garry Smith

unread,
Feb 6, 2014, 1:37:51 PM2/6/14
to web...@googlegroups.com
HI

I have just started using web2py, but have used MVC in other programming languages, the problem I have gaot is importing a db from MySQL.  I use the script in the scripts folder for extracting from MySQL, which worked fine.  When I added to web2py, most of the tables work fine, but one table keeps giving an flash error saying "Invalid query 1054, "Unknown column 'user.id' in 'where clause'".
Not surw how to correct.

This is the full error

Traceback (most recent call last):
  File "/home/gazza/Downloads/web2py/applications/school/controllers/appadmin.py", line 250, in select
    nrows = db(query, ignore_common_filters=True).count()
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 10325, in count
    return db._adapter.count(self.query,distinct)
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1851, in count
    self.execute(self._count(query, distinct))
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1916, in execute
    return self.log_execute(*a, **b)
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1910, in log_execute
    ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'user.id' in 'where clause'")

Massimo Di Pierro

unread,
Feb 7, 2014, 1:54:59 PM2/7/14
to web...@googlegroups.com
Is it possible the table you are querying does not have an id field? Can you show the model?
Reply all
Reply to author
Forward
0 new messages