fake_migrate makes pyDAL think the model definition reflects the actual schema in the database. Presumably the field in question does not actually exist in the database. If that's the only field missing from the database, do the following:
1. Delete the *.table file for this table in the /databases folder. 2. Comment out the line defining the missing field. 3. Leave fake_migrate=True and run one request -- that will re-create the *.table file, but without the missing field, so pyDAL will know to add the field in the next real migration. 4. Remove fake_migrate everywhere -- you don't need it unless you are correcting a migration problem. 5. Set migrate=True. 6. Remove the comment from #2 above and run another request -- pyDAL will now create the missing field. Anthony On Thursday, August 30, 2018 at 4:13:02 PM UTC-4, mostwanted wrote: > > I have a database which i recently updated by adding a new table called > *tlamelo*, the new table is referenced in one of the old tables called > *company, > *when i try to save data into the table *company* i get the error bellow > *(table > company has no column named tlamelo)!* I do not understand why i am > getting this error, i am not sure if it has anything to do with the > fake_migrate=True > or not! Can anyone please help me, thank you. > > <class 'sqlite3.OperationalError'> table company has no column named > tlamelo > > This is the code for my table tlamelo > db.define_table('tlamelo', > Field('leina_la_tlamelo', requires=IS_NOT_EMPTY()), > format='%(leina_la_tlamelo)s', migrate=False, fake_migrate > =True) > > This is the code for my table company > db.define_table('company', > Field('logo', 'upload'), > Field('company_name', requires=IS_NOT_EMPTY()), > Field('services', 'reference services'), > Field('tlamelo', 'reference tlamelo'), #tlamelo is > referenced here > Field('product', 'reference product'), > Field('tel', requires=IS_NOT_EMPTY()), > Field('email', requires=IS_NOT_EMPTY()), > Field('fax', requires=IS_NOT_EMPTY()), > Field('cell', requires=IS_NOT_EMPTY()), > Field('facebook', requires=IS_NOT_EMPTY()), > Field('twitter', requires=IS_NOT_EMPTY()), > Field('website', requires=IS_NOT_EMPTY()), > Field('postal_address', requires=IS_NOT_EMPTY()), > Field('located_at', requires=IS_NOT_EMPTY()), migrate= > False, fake_migrate=True) > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.