Problem
When trying to connect using the databricks-sql-python
package from your local Python environment or using development tools like VSCode or PyCharm, you receive a certificate error.
MaxRetryError (note: full exception trace is shown but execution 1is paused at: _run_module_as_main)
HTTPSConnectionPool(host='my-workspace.cloud.databricks.com', port=443): Max retries exceeded with url: /sql/protocolv1/o/workspaceID/xxxx-xxxxxx-xxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))
Cause
The custom certificate (self-signed certificate) within your local Python environment does not exist, or the connection cuts off when trying to communicate with the Databricks endpoint.
Solution
Make sure the current Python self-certificate used with the databricks-sql-python
package is valid and updated. You may need to first confirm the details for your particular OS environment and verify with your IT Team that such certificates are valid within your network.
For more information on certificates, please refer to the Python certifi 2024.8.30 documentation.