This is an automated email from the ASF dual-hosted git repository.
henry3260 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 615068e7cfb Remove deprecated get_pandas_df methods from SQL hooks
(#76130)
615068e7cfb is described below
commit 615068e7cfb1077e2c91eda98d4a0deac126dcf7
Author: Shahar Epstein <[email protected]>
AuthorDate: Sat Oct 31 18:11:42 2026 +0200
Remove deprecated get_pandas_df methods from SQL hooks (#76130)
* Remove deprecated get_pandas_df methods from DbApiHook
Remove DbApiHook.get_pandas_df and DbApiHook.get_pandas_df_by_chunks,
deprecated since 2025-04-16 in #48875. Use get_df(..., df_type="pandas") and
get_df_by_chunks(..., df_type="pandas") instead.
* Remove deprecated get_pandas_df from ExasolHook
The ExasolHook.get_pandas_df override, deprecated since 2025-05-01 in
#50017, has been removed. Use get_df(..., df_type="pandas") instead.
* Remove deprecated get_pandas_df from HiveServer2Hook
The HiveServer2Hook.get_pandas_df override, deprecated since 2025-05-02 in
#50070, has been removed. Use get_df(..., df_type="pandas") instead.
* Remove deprecated get_pandas_df from PrestoHook and TrinoHook
The PrestoHook.get_pandas_df and TrinoHook.get_pandas_df overrides,
deprecated since 2025-05-02 in #50123, have been removed. Use get_df(...,
df_type="pandas") instead.
---
providers/apache/hive/docs/changelog.rst | 3 ++
.../airflow/providers/apache/hive/hooks/hive.py | 18 +----------
providers/common/sql/docs/changelog.rst | 3 ++
.../src/airflow/providers/common/sql/hooks/sql.py | 37 ----------------------
.../src/airflow/providers/common/sql/hooks/sql.pyi | 6 ----
providers/exasol/docs/changelog.rst | 3 ++
.../src/airflow/providers/exasol/hooks/exasol.py | 22 -------------
providers/presto/docs/changelog.rst | 3 ++
.../src/airflow/providers/presto/hooks/presto.py | 10 ------
providers/trino/docs/changelog.rst | 3 ++
.../src/airflow/providers/trino/hooks/trino.py | 10 ------
11 files changed, 16 insertions(+), 102 deletions(-)
diff --git a/providers/apache/hive/docs/changelog.rst
b/providers/apache/hive/docs/changelog.rst
index b3fea788664..3afee22a8d9 100644
--- a/providers/apache/hive/docs/changelog.rst
+++ b/providers/apache/hive/docs/changelog.rst
@@ -27,6 +27,9 @@
Changelog
---------
+.. warning::
+ The deprecated ``HiveServer2Hook.get_pandas_df`` method has been removed.
Use ``get_df(..., df_type="pandas")`` instead.
+
9.7.1
.....
diff --git
a/providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py
b/providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py
index 0a3a917e130..c6b08535e6c 100644
--- a/providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py
+++ b/providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py
@@ -28,9 +28,7 @@ from collections.abc import Iterable, Mapping
from tempfile import NamedTemporaryFile, TemporaryDirectory
from typing import TYPE_CHECKING, Any, Literal, overload
-from deprecated import deprecated
-
-from airflow.exceptions import AirflowOptionalProviderFeatureException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowOptionalProviderFeatureException
from airflow.providers.common.compat.sdk import (
AIRFLOW_VAR_NAME_FORMAT_MAPPING,
AirflowException,
@@ -1162,20 +1160,6 @@ class HiveServer2Hook(DbApiHook):
if df_type == "polars":
return self._get_polars_df(sql, schema=schema,
hive_conf=hive_conf, **kwargs)
- @deprecated(
- reason="Replaced by function `get_df`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df( # type: ignore
- self,
- sql: str,
- schema: str = "default",
- hive_conf: dict[Any, Any] | None = None,
- **kwargs,
- ) -> pd.DataFrame:
- return self._get_pandas_df(sql, schema=schema, hive_conf=hive_conf,
**kwargs)
-
@property
def sqlalchemy_url(self) -> URL:
"""Return a `sqlalchemy.engine.URL` object constructed from the
connection."""
diff --git a/providers/common/sql/docs/changelog.rst
b/providers/common/sql/docs/changelog.rst
index 16078418a37..e4e0b4be499 100644
--- a/providers/common/sql/docs/changelog.rst
+++ b/providers/common/sql/docs/changelog.rst
@@ -25,6 +25,9 @@
Changelog
---------
+.. warning::
+ The deprecated ``DbApiHook.get_pandas_df`` and
``DbApiHook.get_pandas_df_by_chunks`` methods have been removed. Use
``DbApiHook.get_df(..., df_type="pandas")`` and
``DbApiHook.get_df_by_chunks(..., df_type="pandas")`` instead.
+
2.4.0
.....
diff --git a/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py
b/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py
index 4f8ec0748cc..fe5c3e9e673 100644
--- a/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py
+++ b/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py
@@ -27,7 +27,6 @@ from typing import TYPE_CHECKING, Any, Literal, Protocol,
TypeVar, cast, overloa
from urllib.parse import urlparse
import sqlparse
-from deprecated import deprecated
from methodtools import lru_cache
from more_itertools import chunked
@@ -45,7 +44,6 @@ except ImportError:
NoSuchModuleError = Exception # type: ignore[misc,assignment]
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.common.compat.module_loading import import_string
from airflow.providers.common.compat.sdk import (
AirflowException,
@@ -450,41 +448,6 @@ class DbApiHook(BaseHook):
self.log.debug("reserved words for '%s': %s", dialect_name, result)
return result
- @deprecated(
- reason="Replaced by function `get_df`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df(
- self,
- sql,
- parameters: list | tuple | Mapping[str, Any] | None = None,
- **kwargs,
- ) -> PandasDataFrame:
- """
- Execute the sql and returns a pandas dataframe.
-
- :param sql: the sql statement to be executed (str) or a list of sql
statements to execute
- :param parameters: The parameters to render the SQL query with.
- :param kwargs: (optional) passed into pandas.io.sql.read_sql method
- """
- return self.get_df(sql, parameters, df_type="pandas", **kwargs)
-
- @deprecated(
- reason="Replaced by function `get_df_by_chunks`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df_by_chunks(
- self,
- sql,
- parameters: list | tuple | Mapping[str, Any] | None = None,
- *,
- chunksize: int,
- **kwargs,
- ) -> Generator[PandasDataFrame, None, None]:
- return self.get_df_by_chunks(sql, parameters, chunksize=chunksize,
df_type="pandas", **kwargs)
-
@overload
def get_df(
self,
diff --git
a/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.pyi
b/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.pyi
index ebdcd58cf66..fab16ced47e 100644
--- a/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.pyi
+++ b/providers/common/sql/src/airflow/providers/common/sql/hooks/sql.pyi
@@ -104,12 +104,6 @@ class DbApiHook(BaseHook):
@property
def reserved_words(self) -> set[str]: ...
def get_reserved_words(self, dialect_name: str) -> set[str]: ...
- def get_pandas_df(
- self, sql, parameters: list | tuple | Mapping[str, Any] | None = None,
**kwargs
- ) -> PandasDataFrame: ...
- def get_pandas_df_by_chunks(
- self, sql, parameters: list | tuple | Mapping[str, Any] | None = None,
*, chunksize: int, **kwargs
- ) -> Generator[PandasDataFrame]: ...
def get_records(
self, sql: str | list[str], parameters: Iterable | Mapping[str, Any] |
None = None
) -> Any: ...
diff --git a/providers/exasol/docs/changelog.rst
b/providers/exasol/docs/changelog.rst
index 261c0fe2e62..df60a489e91 100644
--- a/providers/exasol/docs/changelog.rst
+++ b/providers/exasol/docs/changelog.rst
@@ -27,6 +27,9 @@
Changelog
---------
+.. warning::
+ The deprecated ``ExasolHook.get_pandas_df`` method has been removed. Use
``get_df(..., df_type="pandas")`` instead.
+
4.11.1
......
diff --git a/providers/exasol/src/airflow/providers/exasol/hooks/exasol.py
b/providers/exasol/src/airflow/providers/exasol/hooks/exasol.py
index 5682b4731c2..0ed32a83ece 100644
--- a/providers/exasol/src/airflow/providers/exasol/hooks/exasol.py
+++ b/providers/exasol/src/airflow/providers/exasol/hooks/exasol.py
@@ -22,7 +22,6 @@ from contextlib import closing
from typing import TYPE_CHECKING, Any, TypeVar, overload
import pyexasol
-from deprecated import deprecated
from pyexasol import ExaConnection, ExaStatement
try:
@@ -30,7 +29,6 @@ try:
except ImportError:
URL = None # type: ignore[assignment,misc]
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
from airflow.providers.common.sql.hooks.handlers import
return_single_query_results
from airflow.providers.common.sql.hooks.lineage import send_sql_hook_lineage
@@ -180,26 +178,6 @@ class ExasolHook(DbApiHook):
df = conn.export_to_pandas(sql,
query_params=_to_query_params(parameters), **kwargs)
return df
- @deprecated(
- reason="Replaced by function `get_df`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df(
- self,
- sql,
- parameters: list | tuple | Mapping[str, Any] | None = None,
- **kwargs,
- ) -> pd.DataFrame:
- """
- Execute the sql and returns a pandas dataframe.
-
- :param sql: the sql statement to be executed (str) or a list of sql
statements to execute
- :param parameters: The parameters to render the SQL query with.
- :param kwargs: (optional) passed into pandas.io.sql.read_sql method
- """
- return self._get_pandas_df(sql, parameters, **kwargs)
-
def _get_polars_df(
self,
sql,
diff --git a/providers/presto/docs/changelog.rst
b/providers/presto/docs/changelog.rst
index b72a187f0ec..c347dfd348f 100644
--- a/providers/presto/docs/changelog.rst
+++ b/providers/presto/docs/changelog.rst
@@ -27,6 +27,9 @@
Changelog
---------
+.. warning::
+ The deprecated ``PrestoHook.get_pandas_df`` method has been removed. Use
``get_df(..., df_type="pandas")`` instead.
+
5.13.1
......
diff --git a/providers/presto/src/airflow/providers/presto/hooks/presto.py
b/providers/presto/src/airflow/providers/presto/hooks/presto.py
index 5cfee1e3fc7..192202627b8 100644
--- a/providers/presto/src/airflow/providers/presto/hooks/presto.py
+++ b/providers/presto/src/airflow/providers/presto/hooks/presto.py
@@ -22,11 +22,9 @@ from collections.abc import Iterable, Mapping
from typing import TYPE_CHECKING, Any, TypeVar
import prestodb
-from deprecated import deprecated
from prestodb.exceptions import DatabaseError
from prestodb.transaction import IsolationLevel
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.common.compat.sdk import (
AirflowException,
AirflowOptionalProviderFeatureException,
@@ -270,14 +268,6 @@ class PrestoHook(DbApiHook):
df = pl.DataFrame(**kwargs)
return df
- @deprecated(
- reason="Replaced by function `get_df`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df(self, sql: str = "", parameters=None, **kwargs):
- return self._get_pandas_df(sql, parameters, **kwargs)
-
def insert_rows(
self,
table: str,
diff --git a/providers/trino/docs/changelog.rst
b/providers/trino/docs/changelog.rst
index 5a13221abc1..33d910d25cf 100644
--- a/providers/trino/docs/changelog.rst
+++ b/providers/trino/docs/changelog.rst
@@ -26,6 +26,9 @@
Changelog
---------
+.. warning::
+ The deprecated ``TrinoHook.get_pandas_df`` method has been removed. Use
``get_df(..., df_type="pandas")`` instead.
+
6.7.1
.....
diff --git a/providers/trino/src/airflow/providers/trino/hooks/trino.py
b/providers/trino/src/airflow/providers/trino/hooks/trino.py
index 24940e4e4c0..0966a179d6f 100644
--- a/providers/trino/src/airflow/providers/trino/hooks/trino.py
+++ b/providers/trino/src/airflow/providers/trino/hooks/trino.py
@@ -25,11 +25,9 @@ from typing import TYPE_CHECKING, Any, TypeVar, overload
from urllib.parse import quote_plus, urlencode
import trino
-from deprecated import deprecated
from trino.exceptions import DatabaseError
from trino.transaction import IsolationLevel
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.common.compat.sdk import (
AirflowException,
AirflowOptionalProviderFeatureException,
@@ -347,14 +345,6 @@ class TrinoHook(DbApiHook):
df = pl.DataFrame(**kwargs)
return df
- @deprecated(
- reason="Replaced by function `get_df`.",
- category=AirflowProviderDeprecationWarning,
- action="ignore",
- )
- def get_pandas_df(self, sql: str = "", parameters=None, **kwargs):
- return self._get_pandas_df(sql, parameters, **kwargs)
-
def insert_rows(
self,
table: str,