[sqlalchemy] Ocassional Gevent BlockingSwitchOutError crashes when using pool_recycle

2020-06-02 Thread Tony Cosentini
Hi all, Apologies for the long-winded question. I'm currently working on an application that uses SQLAlchemy along with gevent + psycogreen + gunicorn. I recently added a pool_recycle of 120 to one of our engines: engine = create_engine( db_url,

Re: [sqlalchemy] Union query between multiple tables

2020-06-02 Thread Mike Bayer
yes, for example with select(): s1 = select([t.c.c1, t.c.c2, t.c.c3]) s2 = select([t2.c.c1, t.c.c2, null().label('col4'), null.label('col5')]) u1 = union(s1, s2) I'd recommend using union() and select() to create these queries. the ORM Query.union() method is not as easy to use and long term

Re: [sqlalchemy] forcing (composite) primary key order?

2020-06-02 Thread Jonathan Vanasco
thanks mike! On Monday, June 1, 2020 at 7:15:23 PM UTC-4, Mike Bayer wrote: > > yes use the PrimaryKeyConstraint() construct > > > > https://docs.sqlalchemy.org/en/13/core/constraints.html?highlight=primarykeyconstraint#sqlalchemy.schema.PrimaryKeyConstraint > > here you'd want to put it in your

[sqlalchemy] Union query between multiple tables

2020-06-02 Thread Justvuur
Hi All, I would like to do a union between 3 or 4 tables using the all powerful sqlalchemy. The tables have about 3 columns that are the same but each table has 2 different columns. Is it possible to do a query as below in sqlalchemy? Select Col1, Col2, Col3, Col4, Col5 from Table1 Union