Skip to content

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

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

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

Conversation

@tejassp-db
Copy link
Copy Markdown
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

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)

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
Comment thread pyproject.toml
"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
Copy Markdown
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?

Copy link
Copy Markdown
Collaborator

@sd-db sd-db Apr 15, 2026

Choose a reason for hiding this comment

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

  • I think we should have tighter pinning today <4.1.6
  • Any reason to update the lower version as well to 4.1.5 ? We can do this here but not required and we never know if this might break some env. IMO let us not update the minimum supported version

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

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

@sd-db sd-db changed the title feat(PECOBLR-2328): add _retry_server_directed_only connection parameter default feat(PECOBLR-2328): add _retry_server_directed_only connection parameter Apr 14, 2026
Copy link
Copy Markdown
Collaborator

@sd-db sd-db left a comment

Choose a reason for hiding this comment

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

Let us also update the CHANGELOG.md to list that we are updating the python-sql-connector dependency

Comment thread pyproject.toml
"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
Copy Markdown
Collaborator

@sd-db sd-db Apr 15, 2026

Choose a reason for hiding this comment

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

  • I think we should have tighter pinning today <4.1.6
  • Any reason to update the lower version as well to 4.1.5 ? We can do this here but not required and we never know if this might break some env. IMO let us not update the minimum supported version

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.

2 participants