Skip to content

Conversation

@sc250072
Copy link
Contributor

@sc250072 sc250072 commented Oct 1, 2025


Related: #38195

Why
The default implementation of DbApiHook.get_uri does not conform to the standard Teradata connection format.

How
Override sqlalchemy_url property to follow the official Teradata SQLAlchemy URI format documented here:
https://pypi.org/project/teradatasqlalchemy/#ConnectionParameters

Return the properly rendered SQLAlchemy URL in get_uri.

Copy link
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Functional wise looks nice, but I'm not that familiar with Teradata. Need another eyes to check on this. Thanks!

@eladkal eladkal merged commit ae33bbb into apache:main Oct 5, 2025
82 checks passed
except ImportError:
from airflow.models.connection import Connection # type: ignore[assignment]

DEFAULT_DB_PORT = 1025
Copy link
Member

Choose a reason for hiding this comment

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

nit: Probably could add a link to the doc that mentions 1025 as a comment above this line.


return conn_config

def get_sqlalchemy_engine(self, engine_kwargs=None):
Copy link
Member

Choose a reason for hiding this comment

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

This is technically a breaking change. @eladkal do we need to do anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sc250072 can you raise PR to re add the function to preserve backward compatibility and raise deprecation warning for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will fall back to this method and return the same URL from sqlalchemy_url. But any case,
I’ll re-add the function with a deprecation warning to preserve backward compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is technically a breaking change. @eladkal do we need to do anything?

Could you please clarify what you mean by a breaking change?
Are you referring to the latest Teradata provider not being compatible with older Airflow versions?

Copy link
Member

Choose a reason for hiding this comment

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

one who uses older Teradata provider might break. (as this method has been removed and might be used), but if we're to bump major version. that should be fine

@property
def sqlalchemy_url(self) -> URL:
"""
Override to return a Sqlalchemy.engine.URL object from the Teradata connection.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Override to return a Sqlalchemy.engine.URL object from the Teradata connection.
Override to return a `sqlalchemy.engine.URL` object from the Teradata connection.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused. override what to return the object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs to be implemented in the provider subclass to return the sqlalchemy.engine.URL object.

@Lee-W to return the sqlalchemy.engine.URL object
Will add the suggestion

abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
TyrellHaywood pushed a commit to TyrellHaywood/airflow that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants