Skip to content

Pandas read_sql_query with SQLAlchemy 2 #51062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
0e8v54kg opened this issue Jan 30, 2023 · 1 comment
Closed
2 tasks done

Pandas read_sql_query with SQLAlchemy 2 #51062

0e8v54kg opened this issue Jan 30, 2023 · 1 comment
Labels
Needs Triage Issue that has not been reviewed by a pandas team member Usage Question

Comments

@0e8v54kg
Copy link

Research

  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.

Link to question on StackOverflow

https://stackoverflow.com/questions/75258045/pandas-read-sql-query-with-sqlalchemy-2

Question about pandas

I have been running Pandas with SQLAlchemy in "Future mode" for about two weeks now and everything has been working okay. This morning PIP has started pulling SQLAlchemy 2.0 as default, which has caused some issues.

sql_query = '''
    SELECT [StartDate] 
      , [EndDate] 
    FROM [dbo].[Accounts]
'''

with source_engine.connect() as source_connection:
    sql_query = pd.read_sql_query(text(sql_query), source_connection)
    df_source = pd.DataFrame(sql_query)

This is now producing this error: TypeError: init() got multiple values for argument 'schema'

Is there something wrong with this code, or is this a compatibility issue?

Setting the SQLAlchemy version back to 1.4 works, but I want to get this working with 2.0

@0e8v54kg 0e8v54kg added Needs Triage Issue that has not been reviewed by a pandas team member Usage Question labels Jan 30, 2023
@mroeschke
Copy link
Member

Thanks for the report. Sqlalchemy 2.0 compatibility is being tracked in #40686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage Issue that has not been reviewed by a pandas team member Usage Question
Projects
None yet
Development

No branches or pull requests

2 participants