Skip to content

Commit

Permalink
fix(databricks): update databricks ODBC connector (#1344)
Browse files Browse the repository at this point in the history
* fix(databricks): update Databricks ODBC connector

The certificate does not validate otherwise

* feat(databricks): allow username/password connection

Useful for community edition, which is how we test it :p

* fix(databricks): no default value for requires field pwd
  • Loading branch information
davinov authored Oct 26, 2023
1 parent 3c9e69e commit 8e8fed0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 9 additions & 2 deletions toucan_connectors/databricks/databricks_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ class DatabricksConnector(ToucanConnector):
http_path: str = Field(
..., description='Databricks compute resources URL', placeholder='sql/protocolv1/o/xxx/yyy'
)
user: str | None = Field(
'token',
description='"token" if you use a personal access token, or username if you connect by username/password',
placeholder='token',
)
pwd: SecretStr = Field(
None, description='Your personal access token', placeholder='dapixxxxxxxxxxx'
...,
description='Your personal access token, or password if you connect by username/password',
placeholder='dapixxxxxxxxxxx',
)
ansi: bool = False
on_demand: bool = Field(
Expand All @@ -53,7 +60,7 @@ def _build_connection_string(self) -> str:
'ThriftTransport': 2,
'SSL': 1,
'AuthMech': 3,
'UID': 'token',
'UID': self.user if self.user is not None else 'token',
'PWD': self.pwd.get_secret_value(),
}
return ';'.join(f'{k}={v}' for k, v in connection_params.items() if v is not None)
Expand Down
7 changes: 3 additions & 4 deletions toucan_connectors/install_scripts/databricks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ fi
apt-get update
apt-get install -fyq libsasl2-modules-gssapi-mit wget unzip
mkdir -p /tmp/databricks
# The next link was extracted from an email received after
# filling: https://databricks.com/spark/odbc-driver-download
wget 'https://public-package.toucantoco.com/connectors_sources/databricks/SimbaSparkODBC-2.6.4.1004-Debian-64bit.zip' \
# This package was downloaded from https://www.databricks.com/spark/odbc-drivers-download
wget 'https://public-package.toucantoco.com/connectors_sources/databricks/SimbaSparkODBC-2.7.5.1012-Debian-64bit.zip' \
-O /tmp/databricks/simbaspark.zip
unzip /tmp/databricks/simbaspark.zip -d /tmp/databricks
dpkg -i /tmp/databricks/SimbaSparkODBC-2.6.4.1004-Debian-64bit/simbaspark_2.6.4.1004-2_amd64.deb
dpkg -i /tmp/databricks/simbaspark_2.7.5.1012-2_amd64.deb
rm -rf /tmp/databricks
touch ~/databricks-installed

0 comments on commit 8e8fed0

Please sign in to comment.