Open saurabhdataeng opened 2 months ago
@benc-db can you please take a look? Seems that error comes from SDK
@saurabhdataeng a quick question: if you use access token instead of oauth - does it work?
@kravets-levko Yes, it works fine when I use access_token.
@kravets-levko
I think the earlier error was due to some request quota exceed. Now I am getting different error with same code.
<Config: host=https://adb-XXXXXXXX.azuredatabricks.net, client_id=XXXXXXXXX, client_secret=***, auth_type=oauth-m2m. Env: DATABRICKS_HOST, DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET>
<Config: host=https://adb-XXXXXXXX.azuredatabricks.net, client_id=XXXXXXXXX client_secret=***, auth_type=oauth-m2m. Env: DATABRICKS_HOST, DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET>
/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'adb-XXXXXXXXX.azuredatabricks.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
warnings.warn(
Traceback (most recent call last):
File "/Users/saurabhkumar/PycharmProjects/pythonProject/test.py", line 30, in <module>
with sql.connect(server_hostname = server_hostname,
File "/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/databricks/sql/__init__.py", line 90, in connect
return Connection(server_hostname, http_path, access_token, **kwargs)
File "/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/databricks/sql/client.py", line 247, in __init__
self._open_session_resp = self.thrift_backend.open_session(
File "/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 549, in open_session
response = self.make_request(self._client.OpenSession, open_session_req)
File "/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 478, in make_request
self._handle_request_error(error_info, attempt, elapsed)
File "/Users/saurabhkumar/PycharmProjects/pythonProject/.venv/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 308, in _handle_request_error
raise network_request_error
databricks.sql.exc.RequestError: Error during request to server
I have found a work around:
Downgraded the databricks-sql-connector version to 2.7.1.dev2 as mentioned here: https://github.com/databricks/databricks-sql-python/issues/169
Now its woking as expected.
@saurabhdataeng this warning comes from urllib and normally should be just printed, but not interrupt your script. Do you have anything that may override that behaviour and change warnings to exceptions? Also, try to disable warnings and see if anything changes:
import warnings
...
warnings.simplefilter("ignore")
@kravets-levko No, I am just using the boilerplate code copied from azure databricks documentation. I downgraded the databricks-sql-connector version as mentioned and now I am not getting any execptions and warnings.
Also experiencing this issue with the boiler plate code, opened a new issue.
I think I found a solution for this in my issue
Just wanted to add some signal that the boilerplate M2M code appears to be non-functional on main
. I'm working on an integration now (which we'll hopefully publish in the near future) and had to scrap the boilerplate here. For reference, the U2M example does appear to work. But M2M is broken.
main.py content
.env content
ERROR
Packages