Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions providers/databricks/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Features
Bug Fixes
~~~~~~~~~

* ``Fix DatabricksSqlHook.get_conn() deprecation warning by passing user_agent_entry without leading underscore (#72102)``
* ``Make 'durable' reach 'default_args' and warn when set below Airflow 3.3 (#71531)``

Doc-only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get_conn(self) -> AirflowConnection:
"catalog": self.catalog,
"session_configuration": session_config or None,
"http_headers": self.http_headers,
"_user_agent_entry": self.user_agent_value,
"user_agent_entry": self.user_agent_value,
**self._get_extra_config(),
**self.additional_params,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,23 @@ def test_get_conn_does_not_leak_proxies_into_connector(mock_connect, mock_get_re
assert "proxies" not in mock_connect.call_args.kwargs


@mock.patch("airflow.providers.databricks.hooks.databricks_sql.sql.connect")
def test_get_conn_passes_user_agent_entry_without_underscore(mock_connect, mock_get_requests):
"""get_conn() must pass ``user_agent_entry`` (no leading underscore) to sql.connect().

databricks-sql-connector deprecated the ``_user_agent_entry`` alias and logs a warning
on every connection when the old name is used.
"""
hook = DatabricksSqlHook(databricks_conn_id=DEFAULT_CONN_ID, http_path=HTTP_PATH)

hook.get_conn()

mock_connect.assert_called_once()
call_kwargs = mock_connect.call_args.kwargs
assert "user_agent_entry" in call_kwargs
assert "_user_agent_entry" not in call_kwargs


class TestFormatQueryTags:
def test_simple_values(self):
result = _format_query_tags({"dag_id": "my_dag", "task_id": "my_task"})
Expand Down