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

2023-01-13 Thread mkmo...@gmail.com
Hi Mike, That's much more concise, thank you. Previously I have always accessed the `_asdict()` private member. Thanks and best regards, Matthew On Thursday, January 12, 2023 at 11:00:58 AM UTC-8 Mike Bayer wrote: > > > On Thu, Jan 12, 2023, at 1:46 PM, mkmo...@gmail.com wrote: > > Hi Mike,

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())

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

2023-01-09 Thread Mike Bayer
On Mon, Jan 9, 2023, at 8:50 PM, mkmo...@gmail.com wrote: > Hello, > > It looks like in 2.0 we can no longer treat a row.Row as a dict. I have a few > cases where I want to do this, such as when I need to get a list of columns, > or when I don't know the column name in advance. > > rows

[sqlalchemy] row.Row and dict behavior in 2.0

2023-01-09 Thread mkmo...@gmail.com
Hello, It looks like in 2.0 we can no longer treat a row.Row as a dict. I have a few cases where I want to do this, such as when I need to get a list of columns, or when I don't know the column name in advance. rows = conn.execute(select(t.c.foo)).fetchall() rows[0].keys() # Not