Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-04 Thread Soumaya Mauthoor
That makes complete sense now, thanks Mike:-) Soumaya Le dim. 4 avr. 2021 à 18:53, Mike Bayer a écrit : > If you are using the legacy engine, that is, without "future=True" in > create_engine(), SQLAlchemy autocommits statements that have strings like > "CREATE TABLE", "INSERT", etc. This is c

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-04 Thread Mike Bayer
If you are using the legacy engine, that is, without "future=True" in create_engine(), SQLAlchemy autocommits statements that have strings like "CREATE TABLE", "INSERT", etc. This is called "library level autocommit", it's deprecated and the whole thing is documented at https://docs.sqlalchemy

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-04 Thread Soumaya Mauthoor
Hey Mike Sorry to be a pain but I finally got postgresql working on my laptop and I'm getting the same behaviour as for sqlite (see below). I'm obviously doing something wrong, any idea where? I'm writing an in-house tutorial on sqlalchemy for colleagues, including an explanation of why we set the

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-01 Thread Soumaya Mauthoor
Ooooh I see thanks for clarifying :-) Soumaya On Thu, 1 Apr 2021, 17:34 Mike Bayer, wrote: > > > On Thu, Apr 1, 2021, at 11:20 AM, Soumaya Mauthoor wrote: > > Hello Mike > > Thanks for quick response! I don't have postgres installed right now so I > tried with sqlite, which is also autocommit b

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-01 Thread Mike Bayer
On Thu, Apr 1, 2021, at 11:20 AM, Soumaya Mauthoor wrote: > Hello Mike > > Thanks for quick response! I don't have postgres installed right now so I > tried with sqlite, which is also autocommit by default. Example ahha - that's again a very specific quirk of the pysqlite driver that it does

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-01 Thread Soumaya Mauthoor
Hello Mike Thanks for quick response! I don't have postgres installed right now so I tried with sqlite, which is also autocommit by default. Example: >>> from sqlalchemy import text, create_engine >>> e = create_engine('sqlite:///foo.db') >>> with e.connect() as conn: conn.execute(text('create ta

Re: [sqlalchemy] autocommit Transaction Isolation Level

2021-04-01 Thread Mike Bayer
On Thu, Apr 1, 2021, at 10:06 AM, sumau wrote: > Hello > > Following advice from this article: > https://www.oddbird.net/2014/06/14/sqlalchemy-postgres-autocommit/ > > and because we run large, consecutive queries, we set our transaction > isolation level to 'autocommit' when connecting to our

[sqlalchemy] autocommit Transaction Isolation Level

2021-04-01 Thread sumau
Hello Following advice from this article: https://www.oddbird.net/2014/06/14/sqlalchemy-postgres-autocommit/ and because we run large, consecutive queries, we set our transaction isolation level to 'autocommit' when connecting to our postgres DB. This means we cannot create explicit transaction