Only one table fails to create in MySQL... and there's nothing special about it.

83 views
Skip to first unread message

Robert Porter

unread,
Jun 29, 2015, 2:37:41 PM6/29/15
to web...@googlegroups.com
I got everything working fine at home on my Ubuntu 14.04 server.  Then I did a git push to pythonanywhere.com.  Web2py created all my new tables except for one, and it continues to fail to create this table.  Tech support at pythonanywhere can't find the problem.

Here's my table that is having problems:

db.define_table('restaurants',
Field('place_id', 'text', required=True),
Field('place_name', 'text'),
Field('rest_lat', 'text'),
Field('rest_lng', 'text'))

I can take off the "required=True" but that doesn't help.  Here's the error chain:

<class '_mysql_exceptions.ProgrammingError'> (1146, "Table 'trytha$test.restaurants' doesn't exist")

Traceback (most recent call last):
  File "/var/www/sites/trytha/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/var/www/sites/trytha/applications/trytha/models/db.py", line 112, in <module>
    Field('rest_lng', 'text'))
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 817, in define_table
    table = self.lazy_define_table(tablename,*fields,**args)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 856, in lazy_define_table
    polymodel=polymodel)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", line 491, in create_table
    fake_migrate=fake_migrate
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", line 604, in migrate_table
    self.execute(sub_query)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", line 1326, in execute
    return self.log_execute(*a, **b)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", line 1320, in log_execute
    ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'trytha$test.restaurants' doesn't exist")


Since this works at home, it's obviously a pythonanywhere problem, but they requested I ask you guys for help troubleshooting it.

So here's my question:  Anyone know a good web hosting company for Web2py?  I really just need vanilla Ubuntu on a server.  Alternatively, if you can figure out the error, that might work too, but given pythonanywhere's weird MySQL requirement of having your username as part of your DB name caused an hour of annoyance when I set everything up the first time, I'm not keen on giving them many more chances.

Niphlod

unread,
Jun 29, 2015, 2:53:57 PM6/29/15
to web...@googlegroups.com
usually it's not rocket science.. do you have a databases/***_restaurants.table in your databases folder ?
if yes, drop it and go to the appadmin controller to recreate it. 
From the error it seems that web2py is trying to migrate a table that is not on the backend but it's supposed to be there (because of a corresponding .table file found on the folder)

Robert Porter

unread,
Jun 30, 2015, 3:30:28 AM6/30/15
to web...@googlegroups.com
Thanks, that seems to have fixed it.  I'd actually checked there (nominally), but since pythonanywhere holds its bare-repositories in a folder tree outside of its normal web2py folder structure, it was a bit confusing.

Niphlod

unread,
Jun 30, 2015, 4:27:08 AM6/30/15
to web...@googlegroups.com
actually, pythonanywhere folks are really collaborative : no need to bash for something they aren't responsible for :P
Reply all
Reply to author
Forward
0 new messages