Deleting the .table files solved the issue- thanks!
Perhaps this should be made clearer in the docs with respect to SQLite. Something like: "Dropping/renaming tables or columns, and changing column types in SQLite is problematic because... Solution is to: - Drop table in SQLiteManager or outside program - Delete all .table records for that table - Let db.py recreate the table" On Dec 20, 12:01 am, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > Indeed 2 does not help. > > If you delete or rename a sqlite table and if you are not doing it > using web2py (db.table.drop()) then you should tell web2py the table > no loger exists. You do this by deleting the databases/ > *_tablename.table files > > On Dec 19, 4:50 pm, Yarin <ykess...@gmail.com> wrote: > > > > > > > > > OK I understand the SQLite issue, but not the options I have. > > > 1) SQLite does support renaming tables. I renamed the table > > in question in SQLiteManager, hoping that web2py would then create a > > new table under the old name. But now web2py simply complains that the > > old table doesn't exist. Why wouldn't it create a new, empty table? > > > 2) According to the web2py docs, "The solution consists in > > updating all records of the table and updating the values in the > > column in question with None." This is quite unclear- how does this > > help? In my situation the column values were already None. > > > I'm afraid I don't understand how to proceed. Is there a work- > > around short of creating an entirely new database file? > > On Dec 19, 3:13 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> > > wrote: > > > > correct. > > > > Because SQLite does not support ALTER TABLE DROP therefore it cannot > > > drop a column from an existing table not even to replace it. It works > > > with the other databases. There is special logic in dal.py to skip > > > this type of migrations in sqlite. > > > > Massimo > > > > On Dec 19, 2:03 pm, Yarin <ykess...@gmail.com> wrote: > > > > > When I change a table definition in db.define_table, either by > > > > dropping a field or changing a field type, the change never seems to > > > > take effect in SQL. Old columns and old field types are always > > > > retained, even though web2py seems to 'think' they've changed. > > > > > I'm using SQLite, and run into this issue repeatedly. > > > > > I've posted specific details on > > > > StackOverflow:http://stackoverflow.com/q/8565024/165673