Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Martijn van Oosterhout
Hoi Mike, On Wednesday, November 14, 2018 at 11:30:18 PM UTC+1, Mike Bayer wrote: > > I have some big ideas for the baked concept which may or may not > impact this area as well. But they are only ideas for now, I have > many explicit SQLAlchemy tasks that I have to get done before I can >

[sqlalchemy] Re: sqlalchemy.dialects.postgresql.ranges.DATERANGE sometimes doesn't get parsed (returned as str)

2018-11-14 Thread Fredrik Blomqvist
I just had a major realization...stared at the code for a few minutes (for the 100th time) and realized this probably happens because I pass in a string when I create the object, and then if I access it before it saves to the DB it never gets parsed. That explains everything. I can't believe it

[sqlalchemy] sqlalchemy.dialects.postgresql.ranges.DATERANGE sometimes doesn't get parsed (returned as str)

2018-11-14 Thread Fredrik Blomqvist
Hello, I've had this "ghost" issue for about half a year now, every now and then. Essentially, I have a model with a DATERANGE column (to match my PostgreSQL daterange column). "Most" of the time this works out well. However, sometimes, seemingly depending on the exact code path (or something

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Mike Bayer
I have some big ideas for the baked concept which may or may not impact this area as well. But they are only ideas for now, I have many explicit SQLAlchemy tasks that I have to get done before I can try to explore that stuff. On Wed, Nov 14, 2018 at 4:34 PM Martijn van Oosterhout wrote: > >

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Martijn van Oosterhout
Hoi Mike, You're right, we should probably measure it first. You state that the simple joins and filters are probably cheap which I don't doubt. We also do correlated subqueries and stuff. Actually, we also use the baking mechanism to cache some of our own processing which goes into the

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Mike Bayer
On Tue, Nov 13, 2018 at 3:49 PM Martijn van Oosterhout wrote: > > Hoi, > > We're starting to do some pretty complicated things with the SQLAlchemy > bakery (because we have some pretty complicated queries) and I have something > I'd like to verify. > > We have queries that are constructed like

Re: Support for "redo"

2018-11-14 Thread Mike Bayer
On Wed, Nov 14, 2018 at 6:07 AM wrote: > > Hi all! > > Is there support in Alembic for anything like the "redo" feature present in > Ruby on Rails' Active Record Migrations tool? I often find myself running an > "upgrade", followed by a "downgrade" and then finally another upgrade, in > order

Re: [sqlalchemy] Cannot reproduce subquery involving difference of scalar and vector (generate_series)

2018-11-14 Thread Mike Bayer
for SELECTING from PG's special functions, see if you can find a solution in the many recipes at https://bitbucket.org/zzzeek/sqlalchemy/issues/3566/figure-out-how-to-support-all-of-pgs for now. I haven't looked closely at your specific problem yet but it seems to correspond with those. On Wed,

Support for "redo"

2018-11-14 Thread samuel . grigolato
Hi all! Is there support in Alembic for anything like the "redo" feature present in Ruby on Rails' Active Record Migrations tool? I often find myself running an "upgrade", followed by a "downgrade" and then finally another upgrade, in order to be sure the migration's rollback function is

[sqlalchemy] Cannot reproduce subquery involving difference of scalar and vector (generate_series)

2018-11-14 Thread Tomáš Sandrini
Hi everyone, I have a database of some `items` which have a range (tsarange => DateTimeRange) column that usually ranges in intervals of a bunch of seconds and I basically want to create an availability statistics of those items (based on their `lower(Item.range)`) for some period (month/day)