Research

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

  • [X] 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

Comment From: mroeschke

Thanks for the report. Sqlalchemy 2.0 compatibility is being tracked in https://github.com/pandas-dev/pandas/issues/40686