Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread jiajunsu . zju
OK. I'll reproduce it and upload all logs of the process. 在 2018年5月14日星期一 UTC+8上午10:48:49,Mike Bayer写道: > > as well as the log that shows this: > > +if self in pool._pool.queue: > +pool.logger.debug("jjs rec already in pool checkin, skip %r", > self) > +return > > >

Re: [sqlalchemy] is it possible to make load_only local to an object only and/or avoid the identity map and/or not available via `get`?

2018-05-13 Thread Jonathan Vanasco
On Sunday, May 13, 2018 at 10:27:16 PM UTC-4, Mike Bayer wrote: > > > that's not true, you can use the same database connection on a second > Session. Just say s2 = Session(bind=s1.connection()). > Thanks, mike. I didn't know this was doable - it seems like the right approach. The

Re: [sqlalchemy] Re: SQLACODEGEN + VSCODE + Intellisense not working.

2018-05-13 Thread Mike Bayer
On Sun, May 13, 2018 at 6:38 AM, Jeremy Flowers wrote: > I added PEP0526 code hint and that fixed it. > >jobrow = > session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first() # > type: Jobmst > > > Is it feasible for the SQLAlchemy tool to correctly

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread Mike Bayer
as well as the log that shows this: +if self in pool._pool.queue: +pool.logger.debug("jjs rec already in pool checkin, skip %r", self) +return actually happening. On Sun, May 13, 2018 at 10:42 PM, Mike Bayer wrote: > On Sun, May 13, 2018 at

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread Mike Bayer
On Sun, May 13, 2018 at 10:35 PM, wrote: > "jjs" is short for my name and "cjr" is my colleague's(JinRong Cai). We work > together and add logs in the same environment, add prefix of name to get a > keyword for log filter. > > The doubled ConnectionRecords(with None

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread jiajunsu . zju
"jjs" is short for my name and "cjr" is my colleague's(JinRong Cai). We work together and add logs in the same environment, add prefix of name to get a keyword for log filter. The doubled ConnectionRecords(with None connection) are got by two different coroutines, and the variable

Re: [sqlalchemy] is it possible to make load_only local to an object only and/or avoid the identity map and/or not available via `get`?

2018-05-13 Thread Mike Bayer
On Sun, May 13, 2018 at 3:21 PM, Jonathan Vanasco wrote: > A better way of conveying my problem might be: `get()` returns any object > which is in the identity map; I am having issues after the identity map is > now populated with some objects which are 'partials' that were

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread Mike Bayer
if that connection error is not handled in "is_disconnect" then this wouldn't invalidate the pool. However we've had lots of problems moving vips around with Galera. I would recommend using haproxy or PGBouncer which are both designed to mitigate this issue. As well as, run Nova under

Re: [sqlalchemy] Re: long transaction after database switched over

2018-05-13 Thread jiajunsu . zju
The scenario we make to reproduce the problem is: 1.stop PG master 2.move the IP of PG from master node to slave node, and make an ARP 3.fail over the PG slave to master That will shut all DB connections to PG master, and in SQLAlchemy we got an exception: ERROR sqlalchemy.pool.QueuePool

Re: [sqlalchemy] is it possible to make load_only local to an object only and/or avoid the identity map and/or not available via `get`?

2018-05-13 Thread Jonathan Vanasco
A better way of conveying my problem might be: `get()` returns any object which is in the identity map; I am having issues after the identity map is now populated with some objects which are 'partials' that were created via 'load_only' parameters. The benefits of using `get` to minimize a

Re: [sqlalchemy] is it possible to make load_only local to an object only and/or avoid the identity map and/or not available via `get`?

2018-05-13 Thread Mike Bayer
On Sat, May 12, 2018 at 4:28 PM, Jonathan Vanasco wrote: > > > On Saturday, May 12, 2018 at 9:49:34 AM UTC-4, Mike Bayer wrote: >> >> >> The former would be a bug. The latter, I'm not sure what you would expect >> it to do. Do you want the unloaded attributes to raise

[sqlalchemy] Re: SQLACODEGEN + VSCODE + Intellisense not working.

2018-05-13 Thread Jeremy Flowers
I added PEP0526 code hint and that fixed it. jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first() # type: Jobmst Is it feasible for the SQLAlchemy tool to correctly add these a the library level? It would be

[sqlalchemy] Re: SQLACODEGEN + VSCODE + Intellisense not working.

2018-05-13 Thread Jeremy Flowers
> > I'd say specifically for this part: > jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']). first() That first method at the end... -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please

[sqlalchemy] Re: SQLACODEGEN + VSCODE + Intellisense not working.

2018-05-13 Thread Jeremy Flowers
I got some feedback on Stack Overflow that sounds promising.. Does SQLAlchemy by any chance use Doctstrings to indicated return types? Seems PyCharm Python IDE may have a work around for this? See:

[sqlalchemy] Re: SQLACODEGEN + VSCODE + Intellisense not working.

2018-05-13 Thread Jeremy Flowers
I got some feedback on Stack Overflow that sounds promising.. Does SQLAlchemy by any chance use Doctstrings to indicated return types? Seems PyCharm Python IDE may have a work around for this? See: https://stackoverflow.com/questions/24684954/pycharm-type-hinting-of-class-fields-instance-variables