Re: [sqlalchemy] Alembic and SA 2: upgrade ends with a rollback

2023-01-15 Thread Mike Bayer
I'm actually running your app here and am not reproducing the issue. There's a few things going on here, and I can see the code here in your "master" branch at least hasn't been updated for 2.0. I made a few small changes, "engine.has_table()" to "inspect(engine).has_table()", some strings prin

Re: [sqlalchemy] Alembic and SA 2: upgrade ends with a rollback

2023-01-15 Thread Mike Bayer
can you add these assertions to env.py? with context.begin_transaction(): assert not context.get_context()._in_external_transaction assert not connection.in_transaction() context.run_migrations() that's the condition necessary for begin_transaction() to call commit() at the end. On

Re: [sqlalchemy] Alembic and SA 2: upgrade ends with a rollback

2023-01-15 Thread Mike Bayer
It's not supposed to have this problem with a clean env.py.If you were running commands on the connection() ahead of calling context.begin_transaction(), that would explain things but I dont see that in your example. short answer call connection.commit() at the end of the block , however th

[sqlalchemy] Alembic and SA 2: upgrade ends with a rollback

2023-01-15 Thread Lele Gaifax
Hi all, I'm in the process of upgrading another app to SA 2, and got no suprises in the process: everything works smooth and all tests pass. Going one step further, implementing a requested feature that involves a database migration, I'm facing a show stopper, probably due to a silly oversight of