Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Mike Bayer
Hi there - Answering line by line is not really a good use of either of our time and I apologize that I cannot really work with the lack of specifics presented here, if I can restate the situation, the "CREATE TABLE AS" use case is not very common, and as far as an ORM use case, I have no idea wha

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Markus Elfring
>> Can a variant of the method “CreateTableAs” (which you published on >> 2015-06-01) become a standard component of the application programming >> interface? > > it can, Thanks for such positive feedback. > but as you are seeing, it's insufficient for what people > actually want to do which i

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Mike Bayer
On Mon, Apr 15, 2019 at 12:22 PM Markus Elfring wrote: >> >> INSERT FROM SELECT refers to an existing table, yes, > > > This SQL command is already supported by your class library. > > >> >> I mention it because you referred to this construct in one of the stack >> overflow >> answers you mention

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Markus Elfring
> > INSERT FROM SELECT refers to an existing table, yes, > This SQL command is already supported by your class library. > I mention it because you referred to this construct in one of the stack > overflow > answers you mentioned. > It was shown that is possible (in principle) to copy some

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Mike Bayer
On Mon, Apr 15, 2019 at 9:53 AM Markus Elfring wrote: >> >> insert.from_select() will accept the Query object directly. > > > Such data addition depends on the detail that a table object exists before, > doesn't it? INSERT FROM SELECT refers to an existing table, yes, I mention it because you re

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Markus Elfring
> > insert.from_select() will accept the Query object directly. > Such data addition depends on the detail that a table object exists before, doesn't it? > if using the CreateTableAs recipe, Do you refer to any additional information source here? > it can be modified to coerce a Query

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-15 Thread Mike Bayer
On Mon, Apr 15, 2019 at 5:41 AM tonthon wrote: > > I tried to set a lower value for the pool_recycle value and it seems to work. > > There is a celery service running in the background, maybe it could affect > the session management. this will reduce the problem but the architectural issue that

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Mike Bayer
insert.from_select() will accept the Query object directly. if using the CreateTableAs recipe, it can be modified to coerce a Query passed to it into a Core statement internally. the code to do this coercion would resemble: def __init__(self, name, query): if isinstance(query, orm.Query):

Re: [sqlalchemy] Creating database tables from queries based on ORM API?

2019-04-15 Thread Markus Elfring
> > both of the above stackoverflow recipes refer to usage of the > SQLAlchemy select() object.When you have an ORM Query object, you > can get the underlying select() from it by calling upon the .statement > accessor: > Thanks for this information. I imagine that there is no need to use

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-15 Thread tonthon
I tried to set a lower value for the pool_recycle value and it seems to work. There is a celery service running in the background, maybe it could affect the session management. Le 12/04/2019 à 15:58, Mike Bayer a écrit : it's likely that a database connection is being returned to the pool in