Message360729
@Aymeric Augustin
> While you're there, it would be cool to provide "connection.autocommit = True" as an API to enable autocommit, because "connection.isolation_level = None" isn't a good API at all -- it's very obscure and has nothing to do with isolation level whatsoever.
+1. We could use this new autocommit property to enable the new full transactional mode (that is to say with transactional DDL):
```
connection.autocommit = True # enable the autocommit mode
connection.autocommit = False # disable the autocommit mode (enable the full transactional mode)
connection.autocommit = None # fallback to connection.isolation_level
```
To transition from the old partial transactional mode (without transactional DDL) by default to the new full transactional mode (with transactional DDL) by default, we could use the following migration strategy:
1. During the deprecation period:
- Add the new autocommit property with the value None by default, so that the old partial transactional mode is still the default.
- Add a deprecation warning for the value None of the autocommit property, in favor of the other values True and False. It will prompt users who enabled the autocommit mode with connection.isolation_level = None to use connection.autocommit = True instead, and users who disabled the autocommit mode (that is to say users who enabled the old partial transactional mode) with connection.isolation_level = DEFERRED/IMMEDIATE/EXCLUSIVE to use connection.autocommit = False instead AND add to their code the potentially missing connection.commit() calls required by the new full transactional mode for committing DDL statements.
2. After the deprecation period:
- Set the value of the autocommit property to False by default, so that the new full transactional mode becomes the new default.
- Remove the value None of the autocommit property and its deprecation warning.
- Remove the value None of the isolation_level property, so that the old partial transactional mode disappears. |
|
Date |
User |
Action |
Args |
2020-01-26 17:03:40 | maggyero | set | recipients:
+ maggyero, ghaering, pitrou, ned.deily, Jeremy Banks, r.david.murray, zzzeek, asvetlov, flox, adamtj, dholth, torsten, monsanto, scott.urban, aymeric.augustin, tshepang, python-dev, Ronny.Pfannschmidt, berker.peksag, Mark.Bucciarelli, Jim.Jewett, steve.dower, malin, bulb, bkircher, carlwgeorge |
2020-01-26 17:03:40 | maggyero | set | messageid: <1580058220.57.0.467917144671.issue10740@roundup.psfhosted.org> |
2020-01-26 17:03:40 | maggyero | link | issue10740 messages |
2020-01-26 17:03:40 | maggyero | create | |
|