[web2py] Re: db manipulation
Migration was not disabled. However, I made a new application duplicating the original db procedures, and I was able to add a field in the field definition in db.py. The new one: db = DAL('sqlite://storage2.db') from gluon.tools import Auth auth = Auth(db) auth.define_tables() db.define_table('info',Field('a') ,Field('b') ,Field('c',requires=IS_NOT_EMPTY()), Field('d'), Field('e'), Field('f',requires=IS_NOT_EMPTY()) ) It should be made clear in the documentation that some db operations must use web2py DAL concepts. In the original, I added a field once using db.sqlexecute and once in the sqlite3 bash command line and they do not show in sqlform indicating some operations must have a specific format which is not defined in the current documentation. Also, in order to customize sqlform, etc., the underlying definitions should be made clear in the documentation. I have not looked at the source yet, but I anticipate this will be time consuming. There was an initial effort at collaborative documentation. Please resume this. On Feb 22, 11:35 am, Anthony abasta...@gmail.com wrote: Did you turn off migrations via DAL(..., migrate=False) or DAL(..., migrate_enabled=False)? Is this in a web2py app, or an external script or shell? On Wednesday, February 22, 2012 2:16:17 PM UTC-5, davidjensen wrote: In db.py, I created a db 'contacts' with a table 'mytable'. I later added a field 'date' to mytable. db.define_table('mytable', Field('date',requires=IS_NOT_EMPTY()), Field('name',requires=IS_NOT_EMPTY()), Field('organization'), Field('notes','text', requires=IS_NOT_EMPTY()) ) The new field did not show. Is it necessary to use db.executesql with an alter statement or is there a way to do this in web2py? I can also use sqlite3 command line. Thanks,
[web2py] Re: db manipulation
It should be made clear in the documentation that some db operations must use web2py DAL concepts. In the original, I added a field once using db.sqlexecute and once in the sqlite3 bash command line and they do not show in sqlform indicating some operations must have a specific format which is not defined in the current documentation. Just to be clear, when you added the column to your db table via executesql and the sqlite3 command line, did you also update your web2py DAL model (i.e., the define_table() definition) to indicate the inclusion of the new field? Or did you simply update the db directly without telling web2py about it? Anthony
[web2py] Re: db manipulation
Did you turn off migrations via DAL(..., migrate=False) or DAL(..., migrate_enabled=False)? Is this in a web2py app, or an external script or shell? On Wednesday, February 22, 2012 2:16:17 PM UTC-5, davidjensen wrote: In db.py, I created a db 'contacts' with a table 'mytable'. I later added a field 'date' to mytable. db.define_table('mytable', Field('date',requires=IS_NOT_EMPTY()), Field('name',requires=IS_NOT_EMPTY()), Field('organization'), Field('notes','text', requires=IS_NOT_EMPTY()) ) The new field did not show. Is it necessary to use db.executesql with an alter statement or is there a way to do this in web2py? I can also use sqlite3 command line. Thanks,
Re: [web2py] Re: db manipulation
Hi, Do you not need to specify a type='string' etc ? Regards, nils On Wed, Feb 22, 2012 at 7:35 PM, Anthony abasta...@gmail.com wrote: Did you turn off migrations via DAL(..., migrate=False) or DAL(..., migrate_enabled=False)? Is this in a web2py app, or an external script or shell? On Wednesday, February 22, 2012 2:16:17 PM UTC-5, davidjensen wrote: In db.py, I created a db 'contacts' with a table 'mytable'. I later added a field 'date' to mytable. db.define_table('mytable', Field('date',requires=IS_NOT_EMPTY()), Field('name',requires=IS_NOT_EMPTY()), Field('organization'), Field('notes','text', requires=IS_NOT_EMPTY()) ) The new field did not show. Is it necessary to use db.executesql with an alter statement or is there a way to do this in web2py? I can also use sqlite3 command line. Thanks,
Re: [web2py] Re: db manipulation
On Wednesday, February 22, 2012 2:39:59 PM UTC-5, nils wrote: Hi, Do you not need to specify a type='string' etc ? Good point. If no type is specified, it defaults to 'string', but assuming the 'date' field is intended to store dates, perhaps he should set the type to 'date'. Anthony