[Python] Flask-SQLAlchemy how to delete all rows in a single table

Discussão em 'Python' iniciado por Stack, Maio 28, 2025.

  1. Stack

    Stack Membro Participativo

    How do I delete all rows in a single table using Flask-SQLAlchemy?

    Looking for something like this:

    >>> users = models.User.query.all()
    >>> models.db.session.delete(users)

    # but it errs out: UnmappedInstanceError: Class '__builtin__.list' is not mapped

    Continue reading...

Compartilhe esta Página