On Mar 23, 5:49 pm, Sven <svenstrin...@gmail.com> wrote:
> Thanks! Adding the field as invisible works. But I prefer to dump -
> drop - create - restore approach. After fiddling around I have two
> questions about that though
>
> 1) Why can I see the db object with corresponding tables in shell, but
> not access the database behind it? (ProgrammingError: Cannot operate
> on a closed database.) I assume either my admin or my application is
> locking it. But why would it do that if no transactions are going on?

It is a known bug with web based shell. Will from from console based
shell.

> 2) In added tot the end of db.py:
>
> for table in db.tables: db[table].drop()
>
> The sql.log shows that most of the tables are indeed dropped (and
> recreated in next request ). But two of my tables are not dropped and
> no mention is made in sql.log. (no other error messages either)
>
> db.tables
>
> in shell shows which tables remained: ['auth_group',
> 'auth_permission', 'participant', 'svo_answer']
>
> So my question becomes how do I get rid of the 'participant' and
> 'svo_answer' tables using web2py (both shell and application)?

mmm. make sure you drop in the order they are references. If you still
have a problem, let me know.

>
> Thanks again.
>
> Sven
>
> On Mar 23, 7:39 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Because you used sqlite  and your made the field "type" as
> > notnull=True. sqlite does not support ALTER TABLE DROP COLUMN so the
> > field is still there. I suggest you dump the dump the db, recerate it
> > and restore the dump or add the field again as invisible (not sure if
> > this will work, give it a try):
>
> > Field('type',default='',writable=False,readable=False)
>
> > On Mar 23, 6:16 am, Sven <svenstrin...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am new to web2py and really like it so far. I just ran into trouble
> > > though, and can't find the solution myself.
>
> > > The error message is:
> > > "IntegrityError: participant.type may not be NULL"
>
> > > as a result of calling:
> > > "db.participant.insert(unique_ref=ref, batch_type=session.batch_type,
> > > batch_name=session.batch_name)"
>
> > > I have defined a table 'participants' and 'type' used to be one of its
> > > fields. However, I changed the definition and the field is now called
> > > 'batch_type'. Since there is currently no 'participant.type' in my
> > > code, why does it show up in the error message?
>
> > > I hope someone has a suggestion.
>
> > > Thanks .
>
> > > Sven

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to