Re: [sqlalchemy] Working with versioned objects and inheritance hierarchies

2017-10-27 Thread jens . troeger
I need to reread your code a few more times Mike. But I just realized that the versioning is an example (almost a recipe), but it's not something that ships with the SA package, yes? Meaning that I'll have to copy much of the history_meta.py

Re: [sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread charles
I'm not querying polymorphically. Let me restate the problem with more details(my post as done in haste). With something like the example I gave(completed with what's missing, e.g. table names, definition for related table), # setup connection # create a session session = Session(...)

Re: [sqlalchemy] Working with versioned objects and inheritance hierarchies

2017-10-27 Thread Mike Bayer
On Fri, Oct 27, 2017 at 4:39 PM, wrote: > Thank you Mike! > > Yes, indeed you are right and I referred to Single Table Inheritance > ! > I would like to version just one subclass, i.e. a

Re: [sqlalchemy] Working with versioned objects and inheritance hierarchies

2017-10-27 Thread jens . troeger
Thank you Mike! Yes, indeed you are right and I referred to Single Table Inheritance ! I would like to version just one subclass, i.e. a subset of that single table, and it sounds like that will work (source

Re: [sqlalchemy] How to add comments inside a big query using Classical SQLAlchemy?

2017-10-27 Thread Matthew Moisen
Hi Mike, Thanks so much - this is excellent. Best regards, Matthew On Fri, Oct 27, 2017 at 10:30 AM, Mike Bayer wrote: > On Thu, Oct 26, 2017 at 8:23 PM, Matthew Moisen > wrote: > > Hi Mike, > > > > Thanks for your reply. > > > > I now have

Re: [sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Sam Lee
Thanks. I was comparing Session.remove() vs. Session().rollback(). So, since I'm not using objects (as in orm), but only use Session().execute(), it's okay to use .rollback() instead of .remove(). But, it's better to use .remove(). I think it's clear now. Thanks On Fri, Oct 27, 2017 at 1:41

Re: [sqlalchemy] Working with versioned objects and inheritance hierarchies

2017-10-27 Thread Mike Bayer
On Thu, Oct 26, 2017 at 9:35 PM, wrote: > Hello, > > I'm looking for a way track changes to table rows, very much like described > in this Stackoverflow question. > > SA supports versioning objects as described in the documentation: >

Re: [sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Mike Bayer
On Fri, Oct 27, 2017 at 11:55 AM, Sam Lee wrote: > I'm using scoped_session in a single threaded daemon that has infinite loop > and sleeps after each iteration. > It's only doing queries (does not write to db). > > I guess unit of work for this daemon is an iteration. > From

Re: [sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread Mike Bayer
On Fri, Oct 27, 2017 at 11:57 AM, wrote: > My SQLAlchemy version is 1.1.14. > > I'm having difficulty understanding behaviours around a polymorphic > hierarchy. > > I have an AbstractConcreteBase and two subclasses. > > The ACB declares some attributes shared by the two

Re: [sqlalchemy] Curious about the rationale behind the design of the pool_recycle setting

2017-10-27 Thread André Caron
Thanks Jonathan! We've been meaning to get into more serious failure/negative testing for a while now. I'll take note of your advice, as it will be useful when we get there. André On Fri, Oct 27, 2017 at 7:54 PM, Jonathan Vanasco wrote: > > > On Friday, October 27,

Re: [sqlalchemy] How to add comments inside a big query using Classical SQLAlchemy?

2017-10-27 Thread Mike Bayer
On Thu, Oct 26, 2017 at 8:23 PM, Matthew Moisen wrote: > Hi Mike, > > Thanks for your reply. > > I now have comments activated for my joins and exists and some other > functions. I'm still at a loss for how to add comments to an indivdiual > column, function, or CASE in the

Re: [sqlalchemy] Curious about the rationale behind the design of the pool_recycle setting

2017-10-27 Thread Jonathan Vanasco
On Friday, October 27, 2017 at 10:26:50 AM UTC-4, André Caron wrote: > > FYI, I tried this out and updated my GitHub project to reflect your > excellent insight. > Since your connections were large enough to notice an effect in production, if you have spare time I suggest doing some tests to

Re: [sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread Simon King
On Fri, Oct 27, 2017 at 4:57 PM, wrote: > My SQLAlchemy version is 1.1.14. > > I'm having difficulty understanding behaviours around a polymorphic > hierarchy. > > I have an AbstractConcreteBase and two subclasses. > > The ACB declares some attributes shared by the two

[sqlalchemy] Excluding attributes from polymorphic hierarchy

2017-10-27 Thread charles
My SQLAlchemy version is 1.1.14. I'm having difficulty understanding behaviours around a polymorphic hierarchy. I have an AbstractConcreteBase and two subclasses. The ACB declares some attributes shared by the two subclasses, and the subclasses have attributes of their own that are not

[sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Sam Lee
I'm using scoped_session in a single threaded daemon that has infinite loop and sleeps after each iteration. It's only doing queries (does not write to db). I guess unit of work for this daemon is an iteration. >From what I'm gathering from documentation, I should create a Session for each unit

Re: [sqlalchemy] Curious about the rationale behind the design of the pool_recycle setting

2017-10-27 Thread André Caron
FYI, I tried this out and updated my GitHub project to reflect your excellent insight. Thanks again! André On Thu, Oct 26, 2017 at 11:40 PM, André Caron wrote: > Thanksl Mike and Jonathan! I wasn't expecting such good advice and such > detailed responses so quickly

Re: [sqlalchemy] Issue with relations on postgres timestamps with the value "-infinity"

2017-10-27 Thread Michel Albert
Thanks for the quick update. I did not have the reflex to look into psycopg2 for this. But indeed, a custom SA type would help here too. On Thursday, 26 October 2017 17:46:29 UTC+2, Mike Bayer wrote: > > On Thu, Oct 26, 2017 at 11:16 AM, Michel Albert > wrote: > > I've run