-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Fix: ensure get_df uses SQLAlchemy engine to avoid pandas warning #52224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your PR! Could you please also include unit tests?
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py
Outdated
Show resolved
Hide resolved
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py
Outdated
Show resolved
Hide resolved
**kwargs, | ||
) -> PandasDataFrame | PolarsDataFrame: | ||
""" | ||
Execute the sql and returns a dataframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe good to mention what type of dataframes it returns and add :return ...: ...
as well into the doc :)
Thanks for the updates! |
Fix PostgresHook.get_df() warning when using non-SQLAlchemy connections
This PR updates the
PostgresHook.get_df()
implementation to avoid triggering aUserWarning
from pandas when the underlying connection is not an instance ofsqlalchemy.engine.Connection
. The patch ensures better compatibility with non-SQLAlchemy connections and avoids log clutter during DAG execution.This change only affects the Postgres provider and does not alter the interface or behavior for existing users using SQLAlchemy-compatible connections.
closes: #52142
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in airflow-core/newsfragments.