1

After dropping a big column in Postgres with alembic, I want to clear it's used space so I'd like to run a VACCUM FULL.

When trying to execute the command I get the following error:

sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) {'S': 'ERROR', 'V': 'ERROR', 'C': '25001', 'M': 'VACUUM cannot run inside a transaction block', 'F': 'xact.c', 'L': '3410', 'R': 'PreventInTransactionBlock'}
[SQL: VACUUM FULL]

I've tried solutions I found online for other DB types, such as:

    with op.get_context().autocommit_block():
        op.execute("VACUUM FULL")

Or any usage of with op.get_bind() as session; session.autocommit = True, but the same error occurs.

Any chance you know what could solve this one?

Thank you!

RoieL
  • 109
  • 7

0 Answers0