Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Jonathan Vanasco
looking at the current `engine.dispose()` (which I should have done sooner), that's pretty much what it's doing -- right? https://bitbucket.org/zzzeek/sqlalchemy/src/55371f4cffa730f65f1b687e9f6287d2ac189227/lib/sqlalchemy/engine/base.py?at=master&fileviewer=file-view-default#base.py-1899:1923

Re: [sqlalchemy] Merge instances of objects without dropping attributes that are not persisted

2018-04-02 Thread Mike Bayer
On Mon, Apr 2, 2018 at 4:29 PM, Ruben Di Battista wrote: > Hello, > > I have some SQLAlchemy-persisted instances of objects that have some > relationships coming from a parallel execution with multiprocessing. When I > reduce the results coming from the several processes, I need to merge some > re

Re: [sqlalchemy] column_property query for a table that has not been defined yet

2018-04-02 Thread Mike Bayer
you need a column-based expression there so you should use literal_column: http://docs.sqlalchemy.org/en/latest/core/sqlelement.html?highlight=literal_column#sqlalchemy.sql.expression.literal_column but also that expression won't be usable in every case because you are correlating it to the name "

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Mike Bayer
we should fix that an add a new method like engine.detach() or something like that which strictly de-associates the engine from the pool of the parent process and makes a new one. right now the way to do that is: engine.pool = engine.pool.recreate() gives it a brand new pool and just loses refer

[sqlalchemy] Merge instances of objects without dropping attributes that are not persisted

2018-04-02 Thread Ruben Di Battista
Hello, I have some SQLAlchemy-persisted instances of objects that have some relationships coming from a parallel execution with multiprocessing. When I reduce the results coming from the several processes, I need to merge some relationships (`satellite` and `ground_station` objects in the code

[sqlalchemy] column_property query for a table that has not been defined yet

2018-04-02 Thread Colton Allen
I'm trying to write a column_property that queries a table that will be defined after the current table is defined. I tried using raw SQL but I'm getting an error. On the "page" table I define a "count_posts" column_property. count_posts = orm.column_property(text( 'SELECT count(post.id) F

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Jonathan Vanasco
On Monday, April 2, 2018 at 1:40:06 PM UTC-4, Mike Bayer wrote: > > now we can probably do better than that but the dispose() case is not > supposed to be that common or critical, it's usually for when you just > did a fork(), and you don't want to reference any of the filehandles > in the par

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Mike Bayer
On Mon, Apr 2, 2018 at 1:36 PM, Jonathan Vanasco wrote: > clarifying: I had run tests, and the checked-out connections are still open > after dispose(), and then garbage collected out. > now we can probably do better than that but the dispose() case is not supposed to be that common or critical,

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Jonathan Vanasco
clarifying: I had run tests, and the checked-out connections are still open after dispose(), and then garbage collected out. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Veri

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Jonathan Vanasco
On Monday, April 2, 2018 at 1:21:26 PM UTC-4, Mike Bayer wrote: > > Connections that are checked out stay open, they > still refer to that dereferenced pool, and I think at the moment they > don't get closed until they are garbage collected along with that pool > object. > Thanks. That's wha

Re: [sqlalchemy] dispose/close question

2018-04-02 Thread Mike Bayer
On Mon, Apr 2, 2018 at 1:10 PM, Jonathan Vanasco wrote: > a question came up in another list, and I just wanted to confirm a behavior > > it looks like `engine.dispose()` doesn't explicitly `close()` any open > connections, but they inherently get closed by the method's behavior. is > that right?

[sqlalchemy] dispose/close question

2018-04-02 Thread Jonathan Vanasco
a question came up in another list, and I just wanted to confirm a behavior it looks like `engine.dispose()` doesn't explicitly `close()` any open connections, but they inherently get closed by the method's behavior. is that right? -- SQLAlchemy - The Python SQL Toolkit and Object Relational