I made all reference fields in my queue ondelete='NO ACTION' and now
it seems to work. I will test some more, but for now, this is closed.
Thanks a bunch, Massimo!

On Sep 19, 5:07 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> yes CASCADE is default.
>
> On Sep 19, 3:57 pm, weheh <richard_gor...@verizon.net> wrote:
>
>
>
> > Massimo: I agree, it seems like an ondelete='CASCADE' behavior. But
> > now I'm confused.
>
> > Maybe I don't understand how ondelete='CASCADE' works. In my example,
> > the child references the parent. If you delete the parent, the child
> > should go away. In actuality, it does. So does the queue because the
> > queue refers to the parent. However, since the child doesn't reference
> > the queue, why would deleting the queue delete the child?
>
> > Regarding the doc, it's not at all clear that ondelete='CASCADE' is
> > the default action if not specified. Also, there is nothing in the doc
> > that says how to turn of ondelete='CASCADE'. I could not find
> > ondelete='NO ACTION'. I have modified the doc accordingly. Please
> > review my edits when you get a chance.
>
> > On Sep 19, 2:00 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > I do not understand
>
> > > > When I delete the parent, it's child is deleted, which is what I expect.
>
> > > how can it be? parent does not link the child
>
> > > > When I delete the queue entry, the child is deleted, which is not 
> > > > desired.
>
> > > This has nothing to do with autodelete, this has to do with
> > > ondelete='cascade'. You want (I think)
>
> > > Field('child',db.child,requires=IS_IN_DB(db,'child.id'),ondelete='NO
> > > ACTION')
>
> > > On Sep 19, 12:48 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > > > db.define_table('child',
> > > >   Field('parent',db.parent,
> > > >     requires=IS_NULL_OR(IS_IN_DB(db,'parent.id','%(title)s'))),
> > > >   Field('name','upload',length=50,
> > > >     autodelete=True,
> > > >     uploadfolder=os.path.join(request.folder,'static/data/child'),
> > > >     uploadseparate=True,
> > > >     )
> > > >   )
> > > > db.define_table('parent',
> > > >   Field('user_id',db.auth_user,
> > > >     requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))),
> > > >   Field('categ',db.categ,label=T('Category'),default=12,
> > > >     requires=IS_IN_DB(db,'categ.id','%(name)s',zero=None)),
> > > >   Field('blah1','string',length=50,label=T('Blah')),
> > > >   Field('blah2','string',length=50,label=T('Blah')),
> > > >   Field('blah3','string',length=50,label=T('Blah')),
> > > > etc.
> > > > )
> > > > db.define_table('queue',
> > > >   Field('user_id',db.auth_user,
> > > >     requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))),
> > > >   Field('parent',db.parent,requires=IS_IN_DB(db,'parent.id')),
> > > >   Field('start','datetime'),
> > > >   Field('end','datetime'),
> > > >   Field('child',db.child,requires=IS_IN_DB(db,'child.id')),
> > > >   )
>
> > > > When I delete the parent, it's child is deleted, which is what I
> > > > expect.
> > > > When I delete the queue entry, the child is deleted, which is not
> > > > desired.
>
> > > > On Sep 19, 1:24 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > Can you show us the table in question and the queue table?
>
> > > > > On Sep 18, 10:59 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > > > > > I have a table with an upload field declared with autodelete=True. 
> > > > > > The
> > > > > > upload file is not really uploaded, it's created on the fly. The 
> > > > > > table
> > > > > > id is referenced by a queue, which is polled to determine whether or
> > > > > > not the upload file needs to be created. Once created, the queue 
> > > > > > entry
> > > > > > is deleted. This is where the problem is -- deleting the queue entry
> > > > > > also deletes the uploaded file. I only want the uploaded file 
> > > > > > deleted
> > > > > > when it's parent record is deleted, not when the queue record is
> > > > > > deleted. I've tried a db.mytable.fieldname.autodelete=False just
> > > > > > before deleting the queue entry, but this doesn't work. What should 
> > > > > > I
> > > > > > be doing?- Hide quoted text -
>
> - Show quoted text -

Reply via email to