I have two entities in a one-to-many relationship. There are instances where one of the entities has more than 999 child entities. I want to delete the entity and its child entities but get a problem with sqlite maximum sql variables:
connection.execute(child.delete().where(child.c.parent_id == parent_id))
connection.execute(parent.delete().where(parent.c.id == parent_id))
sqlalchemy.exc.OperationalError:
OperationalError: (OperationalError) too many SQL variables u'DELETE FROM child WHERE child.parent_id IN (?,?...
I have found that the maxium sql variables in sqlite is 999 so that's where my problem is. I read the answer in another question that this is a modeling problem (https://stackoverflow.com/a/8433514/931325), but I don't see how I can model my data in a different way.
What are my options to solve this problem?