Skip to content

get_df UserWarning for PostgresHook #52142

@cultcom

Description

@cultcom

Apache Airflow Provider(s)

postgres

Versions of Apache Airflow Providers

apache-airflow-providers-postgres==6.2.0

Apache Airflow version

3.0.2

Operating System

Mint 21.3

Deployment

Virtualenv installation

Deployment details

No response

What happened

from airflow.providers.postgres.hooks.postgres import PostgresHook
hook = PostgresHook(postgres_conn_id="pg_default")
hook.get_df("select * from test limit 20")
[2025-06-24T10:46:46.435+0200] {base.py:65} INFO - Connection Retrieved 'pg_default'
/home/user/airflowtest/venv/lib/python3.10/site-packages/airflow/providers/common/sql/hooks/sql.py:482
UserWarning: pandas only supports SQLAlchemy connectable (engine/
connection) or database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy.
Out[43]:

What you think should happen instead

The provider should implement the use of sqlalchemy for get_df type=pandas.

How to reproduce

See description above. Simple call the get_df() in ipython.

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions