databricks-sql-python icon indicating copy to clipboard operation
databricks-sql-python copied to clipboard

ERROR:databricks.sql.common.unified_http_client:HTTP request error: Retry request would exceed Retry policy max retry duration of 300 seconds

Open jimsan6817 opened this issue 3 months ago • 4 comments

My Code:

conn = sql.connect(server_hostname = server_hostname, http_path = http_path, access_token = access_token, _tls_no_verify=True)
cursor = conn.cursor()
select_sql="select * from tableA"
cursor.execute(select_sql)

Then console show error as follows:

cursor.execute(select_sql) start : 2025-11-18 09:11:09

**2025-11-18 09:12:18,717 WARNING:urllib3.connectionpool:Retrying (DatabricksRetryPolicy(total=9, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3cb45eb610>, 'Connection to dbstoragejjgoq3xz6zawu.blob.core.windows.net timed out. (connect timeout=60)')': /jobs/8235627411498389/sql/2025-11-18/01/results_2025-11-18T01:11:13Z_4c427180-1208-4c20-924a-f36a81468ec2?sig=<REDACTED>&se=<REDACTED>&sv=<REDACTED>&spr=<REDACTED>&sp=<REDACTED>&sr=<REDACTED>

2025-11-18 09:13:26,777 WARNING:urllib3.connectionpool:Retrying (DatabricksRetryPolicy(total=8, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3cb45eaf10>, 'Connection to dbstoragejjgoq3xz6zawu.blob.core.windows.net timed out. (connect timeout=60)')': /jobs/8235627411498389/sql/2025-11-18/01/results_2025-11-18T01:11:13Z_4c427180-1208-4c20-924a-f36a81468ec2?sig=<REDACTED>&se=<REDACTED>&sv=<REDACTED>&spr=<REDACTED>&sp=<REDACTED>&sr=<REDACTED>**

And Finally Got this error:

2025-11-18 09:19:18,996 ERROR:databricks.sql.common.unified_http_client:HTTP request error: Retry request would exceed Retry policy max retry duration of 300 seconds

May I ask, what are the possible solutions to fix this kind of error?

urllib3 v2.2.3 databricks-sql-python v4.1.4

jimsan6817 avatar Nov 18 '25 01:11 jimsan6817

I did a bunch of digging on this one as it hit our team as well.

The enabling of the circuitbreaker in 4.2.2 has caused this behavior. Previously the library allowed https:// in the path. The changes introduced in the telemetry client circuit breaker prepends https:// to the URL which causes this to break when checking the server side feature flag.

This was not an issue prior to 4.2.2 as the breaker was disabled by default but enabled in 4.2.2 with no exposure/access to the flag to turn it off by an end user.

It seems the call to check the server side feature flag is made regardless if telemetry is enabled or not, and since the flag is not is exposed I was unable to find a way to disable the feature flag check.

As a note we use this with DBT which also complicates some things.

The fix for now is to remove the https:// but this was a major change enabling telemetry that came in on a minor release. Which is kind of disheartening and not very transparent. Would love to see some clearer communication and flagging around this instead of just failing when the external feature flags fail.

tkeller-moxe avatar Dec 29 '25 18:12 tkeller-moxe

@nikhilsuri-db - please take a look on this one.

samikshya-db avatar Dec 29 '25 18:12 samikshya-db

Hi @tkeller-moxe Sorry for the trouble this caused! We updated the docs when 4.2.2 was released to cover telemetry settings. The connector has an enable_telemetry flag, but you're right that it's not accessible through dbt-databricks.

We're working on a fix to handle hostnames with https:// prefixes properly (which is common in dbt setups). We'll keep you posted once it's ready.

nikhilsuri-db avatar Dec 30 '25 04:12 nikhilsuri-db

Ah I missed the link to the databricks documentation thanks for sharing. Appreciate the action! Caught our team off guard and we have implemented out own workaround for now but will be nice to remove that complexity later!

tkeller-moxe avatar Dec 31 '25 14:12 tkeller-moxe