olirice / alembic_utils

An alembic/sqlalchemy extension for migrating sql views, functions, triggers, and policies
https://olirice.github.io/alembic_utils
MIT License
211 stars 43 forks source link

connection was closed in the middle of operation #128

Open AntonOfTheWoods opened 4 months ago

AntonOfTheWoods commented 4 months ago

I'm just getting started trying to set up a trigger and function for a supabase user profile table with autogenerate.

Any attempt to import anything from alembic_utils fails when I try to autogenerate:

...
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 789, in _handle_exception
    raise translated_error from error
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.ConnectionDoesNotExistError'>: connection was closed in the middle of operation
[SQL: SAVEPOINT sa_savepoint_1]
(Background on this error at: https://sqlalche.me/e/20/dbapi)
command terminated with exit code 1

I'm using alembic==1.13.1, alembic-utils==0.8.2 and sqlalchemy==2.0.30. I couldn't find anything in the instructions.

Is this a bug or am I holding it wrong?

olirice commented 4 months ago

Could you please try to produce a minimal reproducible example so I can dig into it locally?

please include your env.py, definition of the trigger, and asyncpg version

olirice commented 4 months ago

It'd be worth testing it with psycopg2-binary to see if you still get the error too