Re: [sqlalchemy] Baked Query with Bound Entity/FromClause

2021-03-31 Thread Scott Colby
Hi Mike, On Wednesday, March 31, 2021 at 1:36:33 PM UTC-4 Mike Bayer wrote: > so this is not what bound parameters are used for in SQL; bound parameters > are a specific construct in the DBAPI driver that only applies to literal > parameters in a statement, that is, strings, numbers and other v

[sqlalchemy] Baked Query with Bound Entity/FromClause

2021-03-31 Thread Scott Colby
Hello, I have a bunch of tables with created_at columns and I would like to bake queries to retrieve counts of rows from them. def _entities_created(model: Model, before: datetime) -> int: baked_query = BAKERY(lambda session: session.query(model)) baked_query += lambda q: q.with_entities

Re: [sqlalchemy] Creating Namespaced/Gapless Sequences Using Event Listeners

2019-10-08 Thread Scott Colby
quot;namespaced sequence factory" which I think might be cool. I’ll post it to the group here if it works out. Thanks again, Scott Colby On Oct 4, 2019, 19:12 -0400, Mike Bayer , wrote: > > > On Fri, Oct 4, 2019, at 3:57 PM, Scott Colby wrote: > > Hello, > > > > I am att

[sqlalchemy] Creating Namespaced/Gapless Sequences Using Event Listeners

2019-10-04 Thread Scott Colby
eSQL `RETURNING` clause or `SELECT FOR UPDATE` but I would prefer to only have one code path for PostgresSQL and SQLite (and others?) if possible. Unfortunately, I'm stumped as how to do this. What is the right approach to implement this pattern? Thank you, Scott Colby -- SQLAlchemy - Th

Re: [sqlalchemy] ROLLBACK not happening with transaction in test suite

2018-06-01 Thread Scott Colby
ultimately passed to the database? Thanks, Scott On Monday, May 28, 2018 at 6:29:14 PM UTC-7, Mike Bayer wrote: > > > > On Mon, May 28, 2018, 8:00 PM Mike Bayer > wrote: > >> On Mon, May 28, 2018 at 7:23 PM, Scott Colby > > wrote: >> > Hello all, >>

[sqlalchemy] ROLLBACK not happening with transaction in test suite

2018-05-28 Thread Scott Colby
27;before_cursor_execute' event? - what am I doing wrong that the transaction doesn't actually get rolled back? (I know that `scoped_session` might not be the most appropriate thing to use here, but that is how the real code works and I want to test in a similar environment