Hi all,
I'm trying to delete cascade a linked row without success.
Could anyone give me some help?
This is my mapper:
mapper(Azienda,
tbl['azienda'],
properties = {
'anagrafica': relation(Anagrafica, cascade='all, delete,
delete-orphan'),
})
the table Azienda has a foreign key (not null) linked to table Anagrafica.
When I try to delete a row from Azienda I would like remove also the
linked row in table Anagrafica... and I supposed it was done by
the instruction on properties: 'anagrafica': relation(Anagrafica,
cascade='all, delete, delete-orphan')... but it doesn't work...
record = Azienda.get( 867 )
session.delete(record)
IntegrityError: ('(IntegrityError) update or delete on table
"anagrafica" violates
foreign key constraint "azienda_id_anagrafica_fkey" on table "azienda"
DETAIL: Key (id)=(313836) is still referenced from table "azienda".
, <bound method Controller.save of
<sicer.BASE.controller.anagraficaAlta.azienda.Controller object at
0x8fde590>>)
'DELETE FROM anagrafica WHERE anagrafica.id = %(id)s' {'id': 313836}
Thanks for any help
j
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.