Re: [sqlalchemy] Retaining plain old python instance member values betwen Flask-SQLAlchemy requests.

2020-02-22 Thread Rob Rosenfeld
For now I have an unoptimized solution working. I don't ever keep a reference to the SQLA instance and in the reconstructor I reattach the ephemeral state. Something like. class User(db.Model): __data_cache = dict() @orm.reconstructor def init_on_load(self): data =

Re: [sqlalchemy] Retaining plain old python instance member values betwen Flask-SQLAlchemy requests.

2020-02-12 Thread Rob Rosenfeld
Thanks for the thoughts. I'm going to digest, read docs, and experiment. On Wed, Feb 12, 2020 at 8:52 AM Mike Bayer wrote: > > > On Tue, Feb 11, 2020, at 11:41 PM, Rob Rosenfeld wrote: > > Hi All, > > I am using Flask-SQLAlchemy on a legacy database. My SQLA classes / > tables are setup

[sqlalchemy] Retaining plain old python instance member values betwen Flask-SQLAlchemy requests.

2020-02-11 Thread Rob Rosenfeld
Hi All, I am using Flask-SQLAlchemy on a legacy database. My SQLA classes / tables are setup using declarative base and autoload. In addition to using the class to access persisted data, I also use plain old Python to enrich them with ephemeral data. Every time I load a User object, I'd