I made a change to one of my models to increase
the size of a VARCHAR field from 64 to 138. I'm
using MySQL 5.0.51a-3ubuntu5.4 and web2py 1.57. I
had the same problem with web2py 1.55.
The SQL shown in sql.log is:
timestamp: 2009-03-04T08:24:03.934903
ALTER TABLE meetups ADD entry_key__tmp VARCHAR(138);
UPDATE meetups SET entry_key__tmp=entry_key;
ALTER TABLE meetups DROP COLUMN entry_key;
ALTER TABLE meetups ADD entry_key VARCHAR(138);
UPDATE meetups SET entry_key=entry_key__tmp;
ALTER TABLE meetups DROP COLUMN entry_key__tmp;
The error I get is:
File "[...] web2py/gluon/main.py", line 368, in wsgibase
SQLDB.close_all_instances(SQLDB.rollback)
File "[...] web2py/gluon/sql.py", line 504, in close_all_instances
action(instance)
File "[...] web2py/gluon/sql.py", line 873, in rollback
self._connection.rollback()
ProgrammingError: (2014, "Commands out of sync; you can't run this
command now")
I put in some additional tracing in sql.py and saw
that the ProgrammingError is related to executing
the migrate query, not the 'rollback' following
the exception.
If I execute the same SQL commands via the mysql
command line interface then the operation is
successful. My model looks like:
mu.define_table("meetups",
SQLField("name", length=128, required=True),
SQLField("comments", "text", default=""),
SQLField("entry_key",length=138), # This is the field that
changed from length=64
SQLField("simp_day"),
SQLField("simp_slot", "integer"),
SQLField("pattern","text"),
SQLField("next_index", "integer"),
SQLField("last_start", "date"), migrate='dw.meetups')
I've seen the -M command line option to web2py but
I'm not sure what it does.
Initially I thought the error message was related to
MySQL not supporting rollback of "ALTER TABLE"
commands but the error seems to be happening
before that point.
I've had a similar problem before with MySQL and
started migrating by hand. I can do that again,
but it would be good to use the auto
migrations if I can.
Does anyone know on how I can avoid the "Commands
out of sync" error?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---