I have 2 tables:
class Table2:
__tablename__ = 'table2'
prov_id = sql.Column(sql.String(36)) # same as prov_id in table1
ref_id = sql.Column(sql.String(36), sql.ForeignKey(
'table1.id'))
class Table1:
__tablename__ = 'table1'
id = sql.Column(sql.String(36), primary_key=True)
prov_id = sql.Column(sql.String(36))
pr = sql.Column(sql.Text)
index = sql.Column(sql.String(36))
table2_info = orm.relationship(Table2,
backref='table2_infos',
cascade='all, delete-orphan')
When I am trying to delete record of Table1 all the Table2 record with
prov_id or ref_id same as record in Table1 also gets deleted. Is it
possible to restrict the deletion of Table2 record to get deleted which
match only to both prov_id and ref_id ?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.