Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandas 2.0 conflicts with the SQL connectors #1085

Open
gventuri opened this issue Apr 2, 2024 · 11 comments 路 May be fixed by #1106
Open

Pandas 2.0 conflicts with the SQL connectors #1085

gventuri opened this issue Apr 2, 2024 · 11 comments 路 May be fixed by #1106

Comments

@gventuri
Copy link
Collaborator

gventuri commented Apr 2, 2024

System Info

OS version: any
Python version: any
pandasai: any

馃悰 Describe the bug

Our current setup is facing issues when attempting to upgrade to pandas versions beyond 2.0, as this update seems to interfere with the functionality of our SQL connectors. It's essential for us to delve into the root cause of this problem to identify a viable solution. This will enable us to successfully transition to a more recent version of pandas, as well as to the latest version of modin.

@ArslanSaleem
Copy link
Collaborator

@gventuri
In pandas 2.0, the read_sql function now mandates SQLAlchemy version 2.0 or higher. However, upgrading SQLAlchemy may cause certain connectors to break, as they do not yet support SQLAlchemy 2.0 or above.

@YarShev
Copy link
Contributor

YarShev commented Apr 11, 2024

@ArslanSaleem, do you have any insight on which connectors do not support sqlalchemy 2.0 or above?

@YarShev YarShev linked a pull request Apr 11, 2024 that will close this issue
3 tasks
@sfc-gh-mvashishtha
Copy link

@ArslanSaleem it looks like snowflake-connector-python[pandas] does not require sqlalchemy at all, and the latest version of snowflake-sqlalchemy seems to allow 2.0.29. As @YarShev , please do let us know which snowflake connector is not working for you. Please also share python and operating system versions.

@asishm
Copy link

asishm commented Apr 14, 2024

@sfc-gh-mvashishtha xref- snowflakedb/snowflake-sqlalchemy#380 - it looks like the latest release on Apr 11 (EDIT: That release got yanked - no reason provided) might have addressed it.

pip install snowflake-sqlalchemy==1.5.1 'sqlalchemy>2.0' fails with

ERROR: Cannot install snowflake-sqlalchemy==1.5.1 and sqlalchemy>2.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested sqlalchemy>2.0
    snowflake-sqlalchemy 1.5.1 depends on sqlalchemy<2.0.0 and >=1.4.0

not sure if this was the core issue, if not apologies!

@gventuri
Copy link
Collaborator Author

@asishm @sfc-gh-mvashishtha from what I see, it might be a problem only from pandas >= 2.2. Can we assume we can safely migrate to pandas > 2 < 2.2 for the time being?

@ArslanSaleem would that work?

@YarShev
Copy link
Contributor

YarShev commented Apr 15, 2024

@gventuri, pandas added support for SQLAlchemy 2.0 as of pandas 2.0.

@YarShev
Copy link
Contributor

YarShev commented Apr 15, 2024

@ArslanSaleem it looks like snowflake-connector-python[pandas] does not require sqlalchemy at all, and the latest version of snowflake-sqlalchemy seems to allow 2.0.29. As @YarShev , please do let us know which snowflake connector is not working for you. Please also share python and operating system versions.

@sfc-gh-mvashishtha, @ArslanSaleem, given that, can we assume there is no an issue with the latest version of snowflake-sqlalchemy?

@rafaelclp
Copy link

rafaelclp commented Apr 18, 2024

@YarShev There is. It's not possible to use pandas 2.2 and snowflake-sqlalchemy in the same project.

Someone tried to add support for 2.0 on their own almost 1 year ago, and sent this PR to the snowflake-sqlalchemy repo: snowflakedb/snowflake-sqlalchemy#414, but it was completely ignored and it's now closed.

There are many issues open in snowflake-sqlalchemy about this lack of support for >=2.0, with the main one being snowflakedb/snowflake-sqlalchemy#380

In that same issue on Mar 9, someone from the snowflake team said (regarding support for sqlalchemy>=2.0):

I can confirm the implementation is currently in progress and we plan to release it by end of Q1 (April 2024). Please note this is not a committed-to date, just a rough estimation which is subject to change.

Hopefully we'll see support for sqlalchemy 2 by the end of April, but I wouldn't bet on it.

If snowflake-sqlalchemy is the only connector blocking the upgrade, I wouldn't wait much longer, unless the snowflake team provided a committed-to-date to support the new version.

@gventuri
Copy link
Collaborator Author

@rafaelclp then what would you recommend? We could also consider installing Snowflake from that feature branch for the short term hoping they'll eventually fix it?

@gventuri
Copy link
Collaborator Author

@ArslanSaleem is only Snowflake blocking the upgrade as far as you know?

@rafaelclp
Copy link

rafaelclp commented Apr 22, 2024

@rafaelclp then what would you recommend? We could also consider installing Snowflake from that feature branch for the short term hoping they'll eventually fix it?

This is just my opinion, so hardly a recommendation. My reasoning is that people using that connector are already stuck with older pandas versions and a 1 year old sqlalchemy version, so I don't see why they couldn't afford to be stuck with older pandas-ai versions as well. That's all. Edit: if someone absolutely must use the latest version of pandas-ai, I think your own suggestion is the best option indeed, just install snowflake-sqlalchemy from the PR that adds support for sqlalchemy 2.0 while waiting for it to be merged.

In any case, I was wrong in betting against support for sqlalchemy 2 in snowflake-sqlalchemy by the end of April: snowflakedb/snowflake-sqlalchemy#469. It's almost here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants