Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-30 Thread Mike Bayer
On Thu, May 30, 2019, at 9:21 AM, Mike Bayer wrote: > > > On Thu, May 30, 2019, at 8:42 AM, Chris Wilson wrote: >> Hi Mike, >> >> On Wed, 29 May 2019 at 15:30, Mike Bayer wrote: >>> Note that we suggested approaches that work in conjunction with the >>> serialized approach you gave, the

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-30 Thread Mike Bayer
On Thu, May 30, 2019, at 8:42 AM, Chris Wilson wrote: > Hi Mike, > > On Wed, 29 May 2019 at 15:30, Mike Bayer wrote: >> Note that we suggested approaches that work in conjunction with the >> serialized approach you gave, the @property approach and the mapper.load() >> event approach. > >

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-30 Thread Chris Wilson
Hi Mike, On Wed, 29 May 2019 at 15:30, Mike Bayer wrote: > Note that we suggested approaches that work in conjunction with the > serialized approach you gave, the @property approach and the mapper.load() > event approach. > Unfortunately I think they would both require massive code

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-29 Thread Mike Bayer
On Wed, May 29, 2019, at 6:22 AM, Chris Wilson wrote: > Hi all, > > Thanks for the replies! Sorry, perhaps I wasn't clear, this is just a minimal > example. We are actually storing serialized objects in a column, which can be > e.g. dicts or lists of (dehydrated) SQLAlchemy objects, numpy

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-29 Thread Chris Wilson
Hi all, Thanks for the replies! Sorry, perhaps I wasn't clear, this is just a minimal example. We are actually storing serialized objects in a column, which can be e.g. dicts or lists of (dehydrated) SQLAlchemy objects, numpy arrays, etc. It's much faster to store (both read and write) a

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-28 Thread Jonathan Vanasco
On Tuesday, May 28, 2019 at 4:35:32 PM UTC-4, Mike Bayer wrote: > > > additionally, running SQL inside of a TypeDecorator is not the intended > usage, as well as using ORM features inside of a TypeDecorator is also not > the intended usage. > thanks, mike. I was 99.99% sure that was the

Re: [sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-28 Thread Mike Bayer
On Tue, May 28, 2019, at 12:03 PM, Jonathan Vanasco wrote: > > > On Tuesday, May 28, 2019 at 9:10:19 AM UTC-4, Chris Wilson wrote: >> >> During initial load one can use a global session object, >> ** > > You should not do that. Global sessions are widely considered an anti-pattern.

[sqlalchemy] Re: TypeDecorators don't know which database session to use

2019-05-28 Thread Jonathan Vanasco
On Tuesday, May 28, 2019 at 9:10:19 AM UTC-4, Chris Wilson wrote: > > During initial load one can use a global session object, > You should not do that. Global sessions are widely considered an anti-pattern. I have discovered a limitation of TypeDecorators (custom column types): > any