I’m trying to delete some rows that a ‘null’ in a Postgresql db by this:
async def delete_empty_batches():
query = Batches.delete().where(Batches.c.acquired_by_warehouse_date is None)
database.execute(query).fetchall()
s = Batches.select()
return await database.execute(s).fetchall()
But nothing happens. I have tried to make a query in pgAdmin and it worked but I can’t get around with python.
I’m green when it comes to programming, how should I be going about this?
2
Answers
Snipped that worked
Try to use the next code snippet:
Note:
==
is used instead ofis
in thewhere
clause to compare values for equality.