Re: [sqlalchemy] Re: Testing and deprecation of nested transactions

2021-08-02 Thread Federico
If you only need to support postgresql you may also create a db to be used as template, then each test gest it's own db generated from the original template db. I think this should be the fastest way of restoring the db state after a test On Mon, 2 Aug 2021, 19:24 Dejan Čabrilo, wrote: > Hi, > >

[sqlalchemy] Re: Testing and deprecation of nested transactions

2021-08-02 Thread Dejan Čabrilo
Hi, >From what I see, that's only pertinent to the ORM, right? I don't use ORM, SqlAlchemy core only, so I think that wouldn't work, right? Thanks! Dejan On Saturday, July 31, 2021 at 7:41:49 AM UTC+2 cfede...@gmail.com wrote: > Hi, > > Have you tried using this pattern from the documentation?

[sqlalchemy] Re: Testing and deprecation of nested transactions

2021-08-02 Thread Dejan Čabrilo
Thanks for the suggestion! Sqlite3 won't work for my use-case because I depend on Postgresql and its extensions a lot. I ended up using this fixture: @pytest.fixture(scope='function') alembic.config.main(argv=["upgrade", "head"]) yield alembic.config.main(argv=["downgrade", "base

[sqlalchemy] Re: Testing and deprecation of nested transactions

2021-07-30 Thread Federico Caselli
Hi, Have you tried using this pattern from the documentation? I think you can also use that while using only connections https://docs.sqlalchemy.org/en/14/orm/session_transaction.html?highlight=after_transaction_end#joining-a-session-into-an-external-transaction-such-as-for-test-suites On Saturd

[sqlalchemy] Re: Testing and deprecation of nested transactions

2021-07-30 Thread 'Jonathan Vanasco' via sqlalchemy
I typically do local developer testing with sqlite3, and the switch the database to postgresql for build/deploy/ci testing in the cloud. For complex tests, I typically use a fresh database "image". e.g. a sqlite file or pgdump output that is tracked in git. This is not the solution you're look