Skip to content

DatabricksSqlHook.sqlalchemy_url lacks http_path if it is defined in a connection #69031

Description

@belegdol

Under which category would you file this issue?

Providers

Apache Airflow version

3.2.2

What happened and how to reproduce it?

I have defined a databricks connection, including http_path extra field. This field was not returned back via sqlalchemy_url property or get_uri() method.

What you think should happen instead?

I would expect the behaviour to mimic get_conn behaviour and return the connection string including the http_path regardless of how it was provided:

def get_conn(self) -> AirflowConnection:
"""Return a Databricks SQL connection object."""
if not self._http_path:
if self._sql_endpoint_name:
endpoint = self._get_sql_endpoint_by_name(self._sql_endpoint_name)
self._http_path = endpoint["odbc_params"]["path"]
elif "http_path" in self.databricks_conn.extra_dejson:
self._http_path = self.databricks_conn.extra_dejson["http_path"]
else:
raise AirflowException(
"http_path should be provided either explicitly, "
"or in extra parameter of Databricks connection, "
"or sql_endpoint_name should be specified"
)

Operating System

Ubuntu 22.04

Deployment

Virtualenv installation

Apache Airflow Provider(s)

databricks

Versions of Apache Airflow Providers

7.16.0

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions