Re: [sqlalchemy] row.Row and dict behavior in 2.0

2023-01-12 Thread Mike Bayer
On Thu, Jan 12, 2023, at 1:46 PM, mkmo...@gmail.com wrote: > Hi Mike, > > Thanks. I have a few cases where it is easiest if I have a plain dict instead > of a RowMapping. For example RowMapping is immutable, and isn't playing > nicely with my json encoder. > > What is your preferred method

Re: [sqlalchemy] row.Row and dict behavior in 2.0

2023-01-12 Thread mkmo...@gmail.com
Hi Mike, Thanks. I have a few cases where it is easiest if I have a plain dict instead of a RowMapping. For example RowMapping is immutable, and isn't playing nicely with my json encoder. What is your preferred method to convert to a plain dict? Row._asdict() dict(RowMapping.items())

[sqlalchemy]

2023-01-12 Thread Kurt Forrester
-- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you

Re: [sqlalchemy] Adding OR () with do_orm_execute

2023-01-12 Thread Mike Bayer
if you have a select() construct, you can add new AND things just calling .where() again. e.g. existing_statement.where(or_(f1, f2)) . On Wed, Jan 11, 2023, at 11:26 PM, Val Huber wrote: > I am using this and it is working well to AND a series of filters to a > statement. > > But I do not

Re: [sqlalchemy] Determine transaction after_flush state

2023-01-12 Thread Mike Bayer
it means the Session is in the middle of the "flush()" method. it's a boolean state. when flush() is over, it turns back off. On Wed, Jan 11, 2023, at 9:27 PM, Val Huber wrote: > Sounds like *session._flushing* is exactly what I want… presuming it means “I > have started flushing, in fact may