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

removed outdated sqlalchemy databricks #696

Conversation

Tanmaypatil123
Copy link
Contributor

@Tanmaypatil123 Tanmaypatil123 commented Oct 29, 2023

Replaced old sqlalchemy-databricks with databricks-sql-connector[sqlalchemy] but still python SDK provided by databricks doesn't support integration with pandas. Beacuse pandas only support sqlalchemy at this time.

As per official repo , databricks-sql-connector[sqlalchemy] exposes a SQLAlchemy dialect for use with tools like pandas.

Summary by CodeRabbit

  • New Feature: Introduced a new configuration option, "catalog", to enhance the interaction with the Databricks SQL endpoint. This option is now available in the DatabricksConnector object and related scripts.
  • Refactor: Improved the readability of the standardize_model_name function in the OpenAI helper module by reorganizing the condition checks.
  • Test: Updated the QueryBuilder().dict() function call in the Databricks connector tests to include the new "catalog" parameter.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2023

Walkthrough

The recent changes primarily focus on introducing a new attribute catalog to the DatabricksConnector and its configuration. This attribute allows users to specify the catalog when interacting with the Databricks SQL endpoint. Additionally, minor adjustments were made to the standardize_model_name function for improved readability.

Changes

File Path Summary
docs/connectors.md
examples/from_databricks.py
Added a new key-value pair "catalog":"sample" to the configuration of a DatabricksConnector object and a JSON configuration file respectively.
pandasai/connectors/base.py
pandasai/connectors/databricks.py
Added a new attribute catalog to the DatabricksConnectorConfig class and modified the _init_connection method in the DatabricksConnector class to include catalog and schema parameters in the connection string.
pandasai/helpers/openai_info.py Adjusted the indentation and line breaks in the standardize_model_name function for better readability.
tests/connectors/test_databricks.py Added a new parameter "catalog" to the function call QueryBuilder().dict(), setting its value to "sample".

🐰💻

"In the land of code, where the shadows lie,

A rabbit hopped, with a twinkle in its eye.

With each key press, a new world unfurls,

'A catalog for Databricks, a gift to boys and girls!'

So hop, hop, hop, with no time to nap,

Celebrate the changes, it's time to clap! 👏🎉"


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cbed878 and 6bd0fd6.
Files ignored due to filter (2)
  • poetry.lock
  • pyproject.toml
Files selected for processing (6)
  • docs/connectors.md (1 hunks)
  • examples/from_databricks.py (1 hunks)
  • pandasai/connectors/base.py (1 hunks)
  • pandasai/connectors/databricks.py (1 hunks)
  • pandasai/helpers/openai_info.py (1 hunks)
  • tests/connectors/test_databricks.py (1 hunks)
Files skipped from review due to trivial changes (5)
  • docs/connectors.md
  • examples/from_databricks.py
  • pandasai/connectors/base.py
  • pandasai/connectors/databricks.py
  • pandasai/helpers/openai_info.py
Additional comments: 1
tests/connectors/test_databricks.py (1)
  • 24-29: The addition of the "catalog" parameter to the DatabricksConnectorConfig instance is consistent with the changes described in the pull request summary. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2023

Codecov Report

Merging #696 (c6822cb) into main (36e307c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##             main     #696   +/-   ##
=======================================
  Coverage   85.37%   85.38%           
=======================================
  Files          70       70           
  Lines        3481     3482    +1     
=======================================
+ Hits         2972     2973    +1     
  Misses        509      509           
Files Coverage Δ
pandasai/connectors/base.py 88.17% <100.00%> (+0.12%) ⬆️
pandasai/connectors/databricks.py 100.00% <ø> (ø)
pandasai/helpers/openai_info.py 91.48% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6bd0fd6 and c6822cb.
Files ignored due to filter (2)
  • poetry.lock
  • pyproject.toml
Files selected for processing (2)
  • pandasai/connectors/base.py (1 hunks)
  • pandasai/helpers/openai_info.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • pandasai/connectors/base.py
Additional comments: 1
pandasai/helpers/openai_info.py (1)
  • 74-83: The logic for checking the model name and appending "-finetuned" or "-completion" seems fine. However, it's important to ensure that the model names being checked here are consistent with the ones in the MODEL_COST_PER_1K_TOKENS dictionary. If there are any discrepancies, it could lead to unexpected behavior or errors.

@Josha91
Copy link

Josha91 commented Jan 6, 2024

Is this blocked by anything, or can it be merged?

@gventuri
Copy link
Collaborator

gventuri commented Jan 6, 2024

@Josha91 the only blocker is it needs to be tested extensively, we can't risk to add regressions. Will test it out asap (if you also want / have the chance to give it a try, it would be awesome) :)

@gventuri gventuri closed this Mar 28, 2024
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.

Switch to databricks-sql-python library for SQL Integration
4 participants