[openstack-dev] [oslo.db][sqlalchemy][mistral] Configuring default transaction isolation level
Renat Akhmerov
rakhmerov at mirantis.com
Thu Dec 10 11:59:19 UTC 2015
> On 08 Dec 2015, at 21:10, Mike Bayer <mbayer at redhat.com> wrote:
>
>
>
> On 12/08/2015 07:28 AM, Renat Akhmerov wrote:
>> Hi,
>>
>> Moshe, thanks a lot for bringing this up. I remember I tried to find a
>> way to change isolation level per connection but also was unable to do that.
>
> Current SQLAlchemy has a lot of isolation level options. There is a
> complete guide to doing this from an ORM perspective at
> http://docs.sqlalchemy.org/en/rel_1_0/orm/session_transaction.html#setting-transaction-isolation-levels.
>
>
> On a per-connection basis, you would use the isolation_level execution
> option. An example of how to integrate this into Session usage is in
> this section at
> http://docs.sqlalchemy.org/en/rel_1_0/orm/session_transaction.html#setting-isolation-for-individual-sessions.
>
> In oslo.db, there's no engine-wide isolation level setting available,
> however when the engine is returned from the oslo.db version of
> create_engine, you can immediately get a copy of that engine with the
> isolation_level option set by calling:
>
> engine = oslo_db.create_engine(...)
> engine = engine.execution_options(isolation_level='READ_COMMITTED’)
This is very helpful, thanks Mike. We’ll try to use this way.
> The future of oslo.db is oriented around the upgraded "enginefacade"
> API. Adding isolation hooks to this new API is a TODO, but is
> straightforward; if you're using the new enginefacade API, I can
> expedite having the appropriate hooks added in.
Yes, I think this is a too important property to just ignore it.
Renat Akhmerov
@ Mirantis Inc.
More information about the OpenStack-dev
mailing list