[Python] How to delete rows containing nulls? [duplicate]

Discussão em 'Python' iniciado por Stack, Abril 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to delete some rows that contain a null in a PostgreSQL database like 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 make it work with Python. How should I be going about this?

    Continue reading...

Compartilhe esta Página