Skip to content

Conversation

@gs11
Copy link

@gs11 gs11 commented Mar 24, 2025

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Other

Description

This naive PR changes pandas to be an optional dependency - just like pyarrow.
Tests fail but seemingly due to unrelated things.

How is this tested?

  • Unit tests
  • E2E Tests
  • Manually
  • N/A

Related Tickets & Documents

#489

@gs11
Copy link
Author

gs11 commented Apr 11, 2025

Any chance to get this reviewed?
@deeksha-db @samikshya-db @jprakash-db @yunbodeng-db @jackyhu-db @benc-db

@FBruzzesi
Copy link

Hey @gs11 thanks for addressing this, I just realized about your PR.
To close #489 you should make sure to avoid importing pandas as top level import in src/databricks/sql/client.py. That would have been my strategy.

I really hope this gets through eventually

@gs11 gs11 force-pushed the optional-pandas branch from ef9308e to eee08e8 Compare April 18, 2025 16:22
@gs11
Copy link
Author

gs11 commented Apr 18, 2025

To close #489 you should make sure to avoid importing pandas as top level import in src/databricks/sql/client.py. That would have been my strategy.

Thanks! @FBruzzesi I realize this change wasn't pushed properly to my branch. Updated it as well as rebased to resolve the poetry.lock conflict issues due to upstream being updated.

@dtroberts
Copy link

dtroberts commented Aug 14, 2025

Hello, I'm just wondering if it's possible to get any movement on this? The large pandas dependency is a blocker for my project.

@gs11 gs11 force-pushed the optional-pandas branch 3 times, most recently from 88098c7 to 439fbd4 Compare September 15, 2025 17:34
@gs11
Copy link
Author

gs11 commented Sep 15, 2025

Any chance of getting this reviewed?
@deeksha-db
@samikshya-db
@jprakash-db
@yunbodeng-db
@jackyhu-db
@benc-db

@ottovis
Copy link

ottovis commented Dec 10, 2025

Is there any way to accelerate this PR? The underlaying issue was opened almost a year ago, and this PR nearing half a year and the issue is still quite blocking for being able to use databricks-sql-python at all.

If there is any way for me to contribute, lmk.

@snowman2
Copy link

@gs11 it appears that there are conflicts. If I had a guess, it would be the lock file needs to be regenerated.

kwargs = {**kwargs, **access_token_kv}

self.disable_pandas = kwargs.get("_disable_pandas", False)
self.disable_pandas = False if pandas is None else kwargs.get("_disable_pandas", False)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.disable_pandas = False if pandas is None else kwargs.get("_disable_pandas", False)
self.disable_pandas = True if pandas is None else kwargs.get("_disable_pandas", False)

I had that backwards. If panda is not installed, it should be disabled.

@snowman2
Copy link

Pandas is also imported here:

@snowman2
Copy link

I imagine they would want a warning message similar to the one for pyarrow:

if pyarrow is None:
logger.warning(
"[WARN] pyarrow is not installed by default since databricks-sql-connector 4.0.0,"
"any arrow specific api (e.g. fetchmany_arrow) and cloud fetch will be disabled."
"If you need these features, please run pip install pyarrow or pip install databricks-sql-connector[pyarrow] to install"
)

@gs11 gs11 force-pushed the optional-pandas branch 2 times, most recently from df0d1ad to e905f74 Compare January 16, 2026 12:26
@gs11
Copy link
Author

gs11 commented Jan 16, 2026

Pandas is also imported here:

I imagine they would want a warning message similar to the one for pyarrow:

if pyarrow is None:
logger.warning(
"[WARN] pyarrow is not installed by default since databricks-sql-connector 4.0.0,"
"any arrow specific api (e.g. fetchmany_arrow) and cloud fetch will be disabled."
"If you need these features, please run pip install pyarrow or pip install databricks-sql-connector[pyarrow] to install"
)

Thanks, updated.

@gs11 gs11 requested review from filipenf and snowman2 January 16, 2026 12:31
Signed-off-by: Gustav Sinder <gustav.sinder@gmail.com>
@gs11 gs11 requested a review from snowman2 January 16, 2026 16:15
@snowman2
Copy link

Are there any tests in the CI run without pandas installed? If not, it would be important to add for future stability.

@gs11
Copy link
Author

gs11 commented Jan 16, 2026

Are there any tests in the CI run without pandas installed? If not, it would be important to add for future stability.

I can't comment on the effectiveness but there's

def test_disable_pandas_respected(self, mock_thrift_backend_class):

@snowman2
Copy link

Are there any tests in the CI run without pandas installed? If not, it would be important to add for future stability.

I can't comment on the effectiveness but there's

def test_disable_pandas_respected(self, mock_thrift_backend_class):

That's helpful. Did you check the CI files to see if there is a test run without optional dependencies installed?

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 this pull request may close these issues.

6 participants