Re: [sqlalchemy] Thread safety in LazyLoader._emit_lazyload

2019-02-19 Thread Mike Bayer
here is your patch: diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 3e7372fac7..ec3c9790f2 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -595,6 +595,9 @@ class LazyLoader(AbstractRelationshipLoader, util.MemoizedSlots

Re: [sqlalchemy] Thread safety in LazyLoader._emit_lazyload

2019-02-19 Thread Mike Bayer
that was actually quite easy! https://github.com/sqlalchemy/sqlalchemy/issues/4507 On Tue, Feb 19, 2019 at 7:18 PM Mike Bayer wrote: > > this will be moving to a github issue, and also I will attempt to > create a proof of concept. > > Everything that happens inside of _memoized_attr__simple_laz

Re: [sqlalchemy] Thread safety in LazyLoader._emit_lazyload

2019-02-19 Thread Mike Bayer
this will be moving to a github issue, and also I will attempt to create a proof of concept. Everything that happens inside of _memoized_attr__simple_lazy_clause involves creating copies of things and the state of the loader strategy is not modified until it's done. There is one "unique=False" fl

[sqlalchemy] Thread safety in LazyLoader._emit_lazyload

2019-02-19 Thread Krzysztof Sulejczak
Hi, I'm maintaining a multi-threaded application which uses sqlalchemy to access mysql db. Some time ago we decided to upgrade sqlalchemy version from 1.1.18 to 1.2.14 and since then we started observing strange problems, the application started throwing IntegrityError in code like that: transl