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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB engine for pandas: sql.connect or sqlalchemy #476

Open
rth opened this issue Nov 27, 2024 · 1 comment
Open

DB engine for pandas: sql.connect or sqlalchemy #476

rth opened this issue Nov 27, 2024 · 1 comment

Comments

@rth
Copy link

rth commented Nov 27, 2024

Hello,

I was wondering what's the best practice for using this package with pandas.

  1. It's possible to create a databricks.sql.connect and pass it to pandas.read_sql. This works however it raises
UserWarning: pandas only supports SQLAlchemy connectable (engine/connection) or database string URI or sqlite3 DBAPI2 
connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy.
  1. Alternatively it's possible to use SQLAlchemy with a databricks:// URL and pass that to pandas. Doesn't it mean an extra serialization step performance wise though?

What's the recommended way, in particular regarding performance? Would both use CloudFetch for larger queries? I see there are some fixes/improvements done for pandas done in PRs so which API should be used to benefit from those?

Thanks!

cc @kravets-levko

@rth
Copy link
Author

rth commented Nov 29, 2024

Unless one is supposed to use fetchall_arrow and convert the resulting PyArrow table to pandas? Some example would be good (also in #21)

Edit: Or actually some util function would be even better as proposed in #134

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

No branches or pull requests

1 participant