Skip to content

feat(PECOBLR-2328): add _retry_server_directed_only connection parameter default#1363

Open
tejassp-db wants to merge 2 commits intomainfrom
feature/retry-server-directed-only
Open

feat(PECOBLR-2328): add _retry_server_directed_only connection parameter default#1363
tejassp-db wants to merge 2 commits intomainfrom
feature/retry-server-directed-only

Conversation

@tejassp-db
Copy link
Collaborator

@tejassp-db tejassp-db commented Mar 24, 2026

Summary

  • Bumps databricks-sql-connector dependency to >=4.1.5, <4.2.0 to pick up the new _retry_server_directed_only parameter (databricks-sql-python#756)
  • Adds _retry_server_directed_only as a default connection parameter (default: false, opt-in) in credentials.py
  • Adds unit tests covering both __pre_deserialize__ defaults and adapter-level pass-through to dbsql.connect()

Context

Customers using use_materialization_v2: true experience duplicate rows when the server returns HTTP 503 after already committing an INSERT. The connector blindly retries, causing data to be written twice. With _retry_server_directed_only: true, retries only occur when the server explicitly sends a Retry-After header, preventing duplicate writes from infrastructure-level 503s.

Users can opt in via profiles.yml:

connection_parameters:
  _retry_server_directed_only: true

Related: ES-1736825

Test plan

  • TestDatabricksCredentialsPreDeserialize — 5 tests for __pre_deserialize__ default/override behavior
  • test_databricks_sql_connector_default_retry_params — verifies defaults reach dbsql.connect()
  • test_databricks_sql_connector_retry_server_directed_only_opt_in — verifies user opt-in flows through
  • All 726 unit tests pass (hatch run unit)

This pull request was AI-assisted by Isaac.

Bump databricks-sql-connector to >=4.1.5 and expose the new
_retry_server_directed_only parameter (default: false) to prevent
duplicate writes caused by blind 503 retries on ExecuteStatement.

Users can opt in via connection_parameters in profiles.yml.

PECOBLR-2328

Co-authored-by: Isaac
Co-authored-by: Isaac
@tejassp-db tejassp-db changed the title [PECOBLR-2328] feat: add _retry_server_directed_only connection parameter default feat(PECOBLR-2328): add _retry_server_directed_only connection parameter default Mar 24, 2026
"click>=8.2.0, <9.0.0",
"databricks-sdk>=0.68.0, <0.78.0",
"databricks-sql-connector[pyarrow]>=4.1.1, <4.1.4",
"databricks-sql-connector[pyarrow]>=4.1.5, <4.2.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jprakash-db Is this acceptable - since we don't want it to move beyond 4.2.0?

@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  credentials.py
Project Total  

This report was generated by python-coverage-comment-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant