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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/connectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ databricks_connector = DatabricksConnector(
"port": 443,
"table": "loan_payments_data",
"httpPath": "/sql/1.0/warehouses/213421312",
"catalog":"sample",
"where": [
# this is optional and filters the data to
# reduce the size of the dataframe
Expand Down
1 change: 1 addition & 0 deletions examples/from_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"port": 443,
"table": "loan_payments_data",
"httpPath": "/sql/1.0/warehouses/213421312",
"catalog": "sample",
"where": [
# this is optional and filters the data to
# reduce the size of the dataframe
Expand Down
1 change: 1 addition & 0 deletions pandasai/connectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class DatabricksConnectorConfig(SQLBaseConnectorConfig):
port: int
token: str
httpPath: str
catalog: str


class BaseConnector(ABC):
Expand Down
2 changes: 1 addition & 1 deletion pandasai/connectors/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _init_connection(self, config: DatabricksConnectorConfig):

"""
self._engine = create_engine(
f"{config.dialect}://token:{config.token}@{config.host}:{config.port}?http_path={config.httpPath}"
f"{config.dialect}://token:{config.token}@{config.host}:{config.port}?http_path={config.httpPath}&catalog={config.catalog}&schema={config.database}"
)

self._connection = self._engine.connect()
Expand Down
8 changes: 4 additions & 4 deletions pandasai/helpers/openai_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def standardize_model_name(
if "ft:" in model_name:
model_name = model_name.split(":")[1] + "-finetuned"
if is_completion and (
model_name.startswith("gpt-4")
or model_name.startswith("gpt-3.5")
or model_name.startswith("gpt-35")
or "finetuned" in model_name
model_name.startswith("gpt-4")
or model_name.startswith("gpt-3.5")
or model_name.startswith("gpt-35")
or "finetuned" in model_name
):
# The cost of completion token is different from
# the cost of prompt tokens.
Expand Down
72 changes: 12 additions & 60 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ openpyxl = { version = "^3.0.7", optional = true }
pymysql = { version = "^1.1.0", optional = true }
psycopg2 = { version = "^2.9.7", optional = true }
yfinance = { version = "^0.2.28", optional = true }
sqlalchemy-databricks = { version = "^0.2.0", optional = true }
snowflake-sqlalchemy = { version = "^1.5.0", optional = true }
databricks-sql-connector = {extras = ["sqlalchemy"], version = "^2.9.3", optional = true }

[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
Expand Down
1 change: 1 addition & 0 deletions tests/connectors/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def setUp(self, mock_create_engine):
database="DATABRICKS_SAMPLE_DATA",
httpPath="/sql/1.0/warehouses/1241rsa32",
table="lineitem",
catalog="sample",
where=[["column_name", "=", "value"]],
).dict()

Expand Down