Re: [sqlalchemy] new tests show a connection/transaction anti-pattern, unsure how to address this.

2018-10-24 Thread Mike Bayer
On Wed, Oct 24, 2018 at 7:15 PM Jonathan Vanasco wrote: > > A new suite of unittests shed light on what appears to be anti-pattern in an > application. I'm not sure how to address this one. > > > The general flow of a particular web request is this: > > > Phase 1- load some database objects for

Re: [sqlalchemy] Getting "MySQL Server has gone away" when closing session

2018-10-24 Thread Mike Bayer
On Wed, Oct 24, 2018 at 7:24 PM Travis Briggs wrote: > > > > On Wed, Oct 24, 2018 at 3:35 PM Mike Bayer wrote: >> >> On Wed, Oct 24, 2018 at 4:54 PM Travis Briggs wrote: >> > >> > Hi, >> > >> > I'm trying to apply a unit of work pattern, where I'm processing all of >> > the "items" in a

Re: [sqlalchemy] Getting "MySQL Server has gone away" when closing session

2018-10-24 Thread Travis Briggs
On Wed, Oct 24, 2018 at 3:35 PM Mike Bayer wrote: > On Wed, Oct 24, 2018 at 4:54 PM Travis Briggs wrote: > > > > Hi, > > > > I'm trying to apply a unit of work pattern, where I'm processing all of > the "items" in a category, and I'm opening my session before I query for > the items in the

[sqlalchemy] new tests show a connection/transaction anti-pattern, unsure how to address this.

2018-10-24 Thread Jonathan Vanasco
A new suite of unittests shed light on what appears to be anti-pattern in an application. I'm not sure how to address this one. The general flow of a particular web request is this: Phase 1- load some database objects for general verification Phase 2- loop through a handful of routines to

Re: [sqlalchemy] Getting "MySQL Server has gone away" when closing session

2018-10-24 Thread Mike Bayer
On Wed, Oct 24, 2018 at 4:54 PM Travis Briggs wrote: > > Hi, > > I'm trying to apply a unit of work pattern, where I'm processing all of the > "items" in a category, and I'm opening my session before I query for the > items in the category, then closing the session when the items are all >

[sqlalchemy] Getting "MySQL Server has gone away" when closing session

2018-10-24 Thread Travis Briggs
Hi, I'm trying to apply a unit of work pattern, where I'm processing all of the "items" in a category, and I'm opening my session before I query for the items in the category, then closing the session when the items are all processed. However, this still could take several minutes and I'm

Re: [sqlalchemy] aliased(MyTable).my_column.comparator.table sometimes is instance of Table instead of Alias

2018-10-24 Thread Mike Bayer
On Wed, Oct 24, 2018 at 4:12 AM Stanisław Skonieczny wrote: > > It uses threads. It may be correlated with high load, as it usually happens > when process is run during upgrade. Schema of the table is as follows (I have > removed unrelated tables and fields): OK so this is not something you

Re: [sqlalchemy] aliased(MyTable).my_column.comparator.table sometimes is instance of Table instead of Alias

2018-10-24 Thread Stanisław Skonieczny
Query that behaves badly is: session.query(MyTable).join(MyOtherTable, and_( ParentMyOtherTable.id == MyTable.parent_id, ParentMyOtherTable.volume_id == MyTable.volume_id )) On Wednesday, 24 October 2018 10:12:43 UTC+2, Stanisław Skonieczny wrote:

Re: [sqlalchemy] aliased(MyTable).my_column.comparator.table sometimes is instance of Table instead of Alias

2018-10-24 Thread Stanisław Skonieczny
It uses threads. It may be correlated with high load, as it usually happens when process is run during upgrade. Schema of the table is as follows (I have removed unrelated tables and fields): from sqlalchemy import Column, BigInteger, ForeignKey from sqlalchemy.ext.declarative import