Re: [sqlalchemy] ORM query returning separate columns instead of objects

2021-09-01 Thread Mike Bayer
you can take the statement and execute it on the connection instead, then you'll get tuples with columns. not sure if there was some way to get this through session.execute() directly. On Tue, Aug 31, 2021, at 5:01 PM, Gord Thompson wrote: > My memory is failing me. I seem to recall that ther

Re: [sqlalchemy] Why was the column information stripped away in SA 1.4.20 that existed in 1.3.20?

2021-09-01 Thread Mike Bayer
this is then the diffeence between tuples and dicts call pandas like this: DataFrame(result.mappings()) that will give it a series of dicts rather than tuples for rows On Wed, Sep 1, 2021, at 8:04 AM, Gord Thompson wrote: > Another workaround would be … > > df = pd.read_sql_query(select(User

Re: [sqlalchemy] SqlAlchemy 1.4 and Sequences

2021-09-01 Thread Mike Bayer
please upgrade to the most recent psycopg2 On Wed, Sep 1, 2021, at 6:12 AM, Francesca L wrote: > Thank you very much for your quick help. > > Yes, you are right, I was using the: "implicit_returning=False" flag on my > "create_engine()". > > I add the following, in case it can be useful to you

Re: [sqlalchemy] Why was the column information stripped away in SA 1.4.20 that existed in 1.3.20?

2021-09-01 Thread Gord Thompson
Another workaround would be … df = pd.read_sql_query(select(User.id, User.name), engine) print(df) """ id name 0 1 Gord 1 2 Bob """ … although it does produce a couple of RemovedIn20Warning messages (that will probably be resolved once pandas does SQLA 1.4 better). On Wednesday, Septem

Re: [sqlalchemy] SqlAlchemy 1.4 and Sequences

2021-09-01 Thread Francesca L
Thank you very much for your quick help. Yes, you are right, I was using the: "implicit_returning=False" flag on my "create_engine()". I add the following, in case it can be useful to you: I removed the flag as suggested, and that's what I get now for the same code example (with sqlalchemy 1.4)

Re: [sqlalchemy] Why was the column information stripped away in SA 1.4.20 that existed in 1.3.20?

2021-09-01 Thread Terrence-Monroe: Brannon
Just for completeness I'm linking to source code to reproduce the problem: play/sqlalchemy-and-pandas at main · metaperl/play (github.com) Looks like the 1.4 release of pandas will remedy this problem. On Wednesday, September 1,

Re: [sqlalchemy] Why was the column information stripped away in SA 1.4.20 that existed in 1.3.20?

2021-09-01 Thread Federico Caselli
Hi, This is a pandas bug, not an sqlalchemy ones. It was already reported here https://github.com/pandas-dev/pandas/issues/40682 On Tuesday, 31 August 2021 at 23:15:04 UTC+2 Gord Thompson wrote: > *With version 1.3:* > > Base = declarative_base() > > > class User(Base): > __tablename__ = "user"