apache-airflow-providers-apache-hive 9.0.6__py3-none-any.whl → 9.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/apache/hive/__init__.py +3 -3
- airflow/providers/apache/hive/hooks/hive.py +88 -15
- {apache_airflow_providers_apache_hive-9.0.6.dist-info → apache_airflow_providers_apache_hive-9.1.0.dist-info}/METADATA +10 -12
- {apache_airflow_providers_apache_hive-9.0.6.dist-info → apache_airflow_providers_apache_hive-9.1.0.dist-info}/RECORD +6 -6
- {apache_airflow_providers_apache_hive-9.0.6.dist-info → apache_airflow_providers_apache_hive-9.1.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_apache_hive-9.0.6.dist-info → apache_airflow_providers_apache_hive-9.1.0.dist-info}/entry_points.txt +0 -0
|
@@ -29,11 +29,11 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "9.0
|
|
32
|
+
__version__ = "9.1.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
|
-
"2.
|
|
35
|
+
"2.10.0"
|
|
36
36
|
):
|
|
37
37
|
raise RuntimeError(
|
|
38
|
-
f"The package `apache-airflow-providers-apache-hive:{__version__}` needs Apache Airflow 2.
|
|
38
|
+
f"The package `apache-airflow-providers-apache-hive:{__version__}` needs Apache Airflow 2.10.0+"
|
|
39
39
|
)
|
|
@@ -27,13 +27,17 @@ from collections.abc import Iterable, Mapping
|
|
|
27
27
|
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
|
28
28
|
from typing import TYPE_CHECKING, Any
|
|
29
29
|
|
|
30
|
+
from deprecated import deprecated
|
|
31
|
+
from typing_extensions import Literal, overload
|
|
32
|
+
|
|
30
33
|
if TYPE_CHECKING:
|
|
31
34
|
import pandas as pd
|
|
35
|
+
import polars as pl
|
|
32
36
|
|
|
33
37
|
import csv
|
|
34
38
|
|
|
35
39
|
from airflow.configuration import conf
|
|
36
|
-
from airflow.exceptions import AirflowException
|
|
40
|
+
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
|
|
37
41
|
from airflow.hooks.base import BaseHook
|
|
38
42
|
from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
|
|
39
43
|
from airflow.providers.common.sql.hooks.sql import DbApiHook
|
|
@@ -1031,37 +1035,106 @@ class HiveServer2Hook(DbApiHook):
|
|
|
1031
1035
|
schema = kwargs["schema"] if "schema" in kwargs else "default"
|
|
1032
1036
|
return self.get_results(sql, schema=schema, hive_conf=parameters)["data"]
|
|
1033
1037
|
|
|
1034
|
-
def
|
|
1038
|
+
def _get_pandas_df( # type: ignore
|
|
1035
1039
|
self,
|
|
1036
1040
|
sql: str,
|
|
1037
1041
|
schema: str = "default",
|
|
1038
1042
|
hive_conf: dict[Any, Any] | None = None,
|
|
1039
1043
|
**kwargs,
|
|
1040
1044
|
) -> pd.DataFrame:
|
|
1045
|
+
try:
|
|
1046
|
+
import pandas as pd
|
|
1047
|
+
except ImportError as e:
|
|
1048
|
+
from airflow.exceptions import AirflowOptionalProviderFeatureException
|
|
1049
|
+
|
|
1050
|
+
raise AirflowOptionalProviderFeatureException(e)
|
|
1051
|
+
|
|
1052
|
+
res = self.get_results(sql, schema=schema, hive_conf=hive_conf)
|
|
1053
|
+
df = pd.DataFrame(res["data"], columns=[c[0] for c in res["header"]], **kwargs)
|
|
1054
|
+
return df
|
|
1055
|
+
|
|
1056
|
+
def _get_polars_df( # type: ignore
|
|
1057
|
+
self,
|
|
1058
|
+
sql: str,
|
|
1059
|
+
schema: str = "default",
|
|
1060
|
+
hive_conf: dict[Any, Any] | None = None,
|
|
1061
|
+
**kwargs,
|
|
1062
|
+
) -> pl.DataFrame:
|
|
1063
|
+
try:
|
|
1064
|
+
import polars as pl
|
|
1065
|
+
except ImportError as e:
|
|
1066
|
+
from airflow.exceptions import AirflowOptionalProviderFeatureException
|
|
1067
|
+
|
|
1068
|
+
raise AirflowOptionalProviderFeatureException(e)
|
|
1069
|
+
|
|
1070
|
+
res = self.get_results(sql, schema=schema, hive_conf=hive_conf)
|
|
1071
|
+
df = pl.DataFrame(res["data"], schema=[c[0] for c in res["header"]], orient="row", **kwargs)
|
|
1072
|
+
return df
|
|
1073
|
+
|
|
1074
|
+
@overload # type: ignore[override]
|
|
1075
|
+
def get_df(
|
|
1076
|
+
self,
|
|
1077
|
+
sql: str,
|
|
1078
|
+
schema: str = "default",
|
|
1079
|
+
hive_conf: dict[Any, Any] | None = None,
|
|
1080
|
+
*,
|
|
1081
|
+
df_type: Literal["pandas"] = "pandas",
|
|
1082
|
+
**kwargs: Any,
|
|
1083
|
+
) -> pd.DataFrame: ...
|
|
1084
|
+
|
|
1085
|
+
@overload # type: ignore[override]
|
|
1086
|
+
def get_df(
|
|
1087
|
+
self,
|
|
1088
|
+
sql: str,
|
|
1089
|
+
schema: str = "default",
|
|
1090
|
+
hive_conf: dict[Any, Any] | None = None,
|
|
1091
|
+
*,
|
|
1092
|
+
df_type: Literal["polars"],
|
|
1093
|
+
**kwargs: Any,
|
|
1094
|
+
) -> pl.DataFrame: ...
|
|
1095
|
+
|
|
1096
|
+
def get_df( # type: ignore
|
|
1097
|
+
self,
|
|
1098
|
+
sql: str,
|
|
1099
|
+
schema: str = "default",
|
|
1100
|
+
hive_conf: dict[Any, Any] | None = None,
|
|
1101
|
+
*,
|
|
1102
|
+
df_type: Literal["pandas", "polars"] = "pandas",
|
|
1103
|
+
**kwargs,
|
|
1104
|
+
) -> pd.DataFrame | pl.DataFrame:
|
|
1041
1105
|
"""
|
|
1042
|
-
Get a pandas dataframe from a Hive query.
|
|
1106
|
+
Get a pandas / polars dataframe from a Hive query.
|
|
1043
1107
|
|
|
1044
1108
|
:param sql: hql to be executed.
|
|
1045
1109
|
:param schema: target schema, default to 'default'.
|
|
1046
1110
|
:param hive_conf: hive_conf to execute alone with the hql.
|
|
1111
|
+
:param df_type: type of dataframe to return, either 'pandas' or 'polars'
|
|
1047
1112
|
:param kwargs: (optional) passed into pandas.DataFrame constructor
|
|
1048
1113
|
:return: result of hive execution
|
|
1049
1114
|
|
|
1050
1115
|
>>> hh = HiveServer2Hook()
|
|
1051
1116
|
>>> sql = "SELECT * FROM airflow.static_babynames LIMIT 100"
|
|
1052
|
-
>>> df = hh.
|
|
1117
|
+
>>> df = hh.get_df(sql, df_type="pandas")
|
|
1053
1118
|
>>> len(df.index)
|
|
1054
1119
|
100
|
|
1055
1120
|
|
|
1056
|
-
:return: pandas.DateFrame
|
|
1121
|
+
:return: pandas.DateFrame | polars.DataFrame
|
|
1057
1122
|
"""
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1123
|
+
if df_type == "pandas":
|
|
1124
|
+
return self._get_pandas_df(sql, schema=schema, hive_conf=hive_conf, **kwargs)
|
|
1125
|
+
if df_type == "polars":
|
|
1126
|
+
return self._get_polars_df(sql, schema=schema, hive_conf=hive_conf, **kwargs)
|
|
1127
|
+
|
|
1128
|
+
@deprecated(
|
|
1129
|
+
reason="Replaced by function `get_df`.",
|
|
1130
|
+
category=AirflowProviderDeprecationWarning,
|
|
1131
|
+
action="ignore",
|
|
1132
|
+
)
|
|
1133
|
+
def get_pandas_df( # type: ignore
|
|
1134
|
+
self,
|
|
1135
|
+
sql: str,
|
|
1136
|
+
schema: str = "default",
|
|
1137
|
+
hive_conf: dict[Any, Any] | None = None,
|
|
1138
|
+
**kwargs,
|
|
1139
|
+
) -> pd.DataFrame:
|
|
1140
|
+
return self._get_pandas_df(sql, schema=schema, hive_conf=hive_conf, **kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-airflow-providers-apache-hive
|
|
3
|
-
Version: 9.0
|
|
3
|
+
Version: 9.1.0
|
|
4
4
|
Summary: Provider package apache-airflow-providers-apache-hive for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,apache.hive,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -20,10 +20,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
|
23
|
-
Requires-Dist: apache-airflow>=2.
|
|
24
|
-
Requires-Dist: apache-airflow-providers-common-sql>=1.
|
|
23
|
+
Requires-Dist: apache-airflow>=2.10.0
|
|
24
|
+
Requires-Dist: apache-airflow-providers-common-sql>=1.26.0
|
|
25
25
|
Requires-Dist: hmsclient>=0.1.0
|
|
26
|
-
Requires-Dist: pandas>=2.1.2,<2.2
|
|
27
26
|
Requires-Dist: pyhive[hive-pure-sasl]>=0.7.0
|
|
28
27
|
Requires-Dist: thrift>=0.11.0
|
|
29
28
|
Requires-Dist: jmespath>=0.7.0
|
|
@@ -35,8 +34,8 @@ Requires-Dist: apache-airflow-providers-presto ; extra == "presto"
|
|
|
35
34
|
Requires-Dist: apache-airflow-providers-samba ; extra == "samba"
|
|
36
35
|
Requires-Dist: apache-airflow-providers-vertica ; extra == "vertica"
|
|
37
36
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
38
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.0
|
|
39
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.0
|
|
37
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.1.0/changelog.html
|
|
38
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.1.0
|
|
40
39
|
Project-URL: Mastodon, https://fosstodon.org/@airflow
|
|
41
40
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
42
41
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
@@ -74,7 +73,7 @@ Provides-Extra: vertica
|
|
|
74
73
|
|
|
75
74
|
Package ``apache-airflow-providers-apache-hive``
|
|
76
75
|
|
|
77
|
-
Release: ``9.0
|
|
76
|
+
Release: ``9.1.0``
|
|
78
77
|
|
|
79
78
|
|
|
80
79
|
`Apache Hive <https://hive.apache.org/>`__
|
|
@@ -87,7 +86,7 @@ This is a provider package for ``apache.hive`` provider. All classes for this pr
|
|
|
87
86
|
are in ``airflow.providers.apache.hive`` python package.
|
|
88
87
|
|
|
89
88
|
You can find package information and changelog for the provider
|
|
90
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.0
|
|
89
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.1.0/>`_.
|
|
91
90
|
|
|
92
91
|
Installation
|
|
93
92
|
------------
|
|
@@ -104,10 +103,9 @@ Requirements
|
|
|
104
103
|
======================================= ==================
|
|
105
104
|
PIP package Version required
|
|
106
105
|
======================================= ==================
|
|
107
|
-
``apache-airflow`` ``>=2.
|
|
108
|
-
``apache-airflow-providers-common-sql`` ``>=1.
|
|
106
|
+
``apache-airflow`` ``>=2.10.0``
|
|
107
|
+
``apache-airflow-providers-common-sql`` ``>=1.26.0``
|
|
109
108
|
``hmsclient`` ``>=0.1.0``
|
|
110
|
-
``pandas`` ``>=2.1.2,<2.2``
|
|
111
109
|
``pyhive[hive_pure_sasl]`` ``>=0.7.0``
|
|
112
110
|
``thrift`` ``>=0.11.0``
|
|
113
111
|
``jmespath`` ``>=0.7.0``
|
|
@@ -140,5 +138,5 @@ Dependent package
|
|
|
140
138
|
====================================================================================================================== ===================
|
|
141
139
|
|
|
142
140
|
The changelog for the provider package can be found in the
|
|
143
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.0
|
|
141
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-apache-hive/9.1.0/changelog.html>`_.
|
|
144
142
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
airflow/providers/apache/hive/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
|
2
|
-
airflow/providers/apache/hive/__init__.py,sha256=
|
|
2
|
+
airflow/providers/apache/hive/__init__.py,sha256=4A8vByNcISGrsZVhWBPVTcf7lp2FsDeWev2kifiVVxM,1500
|
|
3
3
|
airflow/providers/apache/hive/get_provider_info.py,sha256=PdxdiZ7fdK1D-BTyZqj1oMS_1GS8_kbz2hZVgWMTkFI,5569
|
|
4
4
|
airflow/providers/apache/hive/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
5
|
-
airflow/providers/apache/hive/hooks/hive.py,sha256=
|
|
5
|
+
airflow/providers/apache/hive/hooks/hive.py,sha256=ay_4PN2DI4NDfk4z88OgbQTeQ5_FlajBZVoYaaEvUhM,45145
|
|
6
6
|
airflow/providers/apache/hive/macros/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
7
7
|
airflow/providers/apache/hive/macros/hive.py,sha256=FEMCR9rEWKFOKtKAvhVWhD5jRJnSYeHepVGgJLzUa2k,4548
|
|
8
8
|
airflow/providers/apache/hive/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
@@ -21,7 +21,7 @@ airflow/providers/apache/hive/transfers/mssql_to_hive.py,sha256=9NVgJESAwPvxl3D1
|
|
|
21
21
|
airflow/providers/apache/hive/transfers/mysql_to_hive.py,sha256=6BkAoYrn9wDfSC0BKHp86EgoUVtqwHGz9nZsielCydQ,7022
|
|
22
22
|
airflow/providers/apache/hive/transfers/s3_to_hive.py,sha256=UDmTXp1mMNWl31qBe_Z3Sqp7VLJym6kQk3gsxkAxP3g,12417
|
|
23
23
|
airflow/providers/apache/hive/transfers/vertica_to_hive.py,sha256=IBiMGF7322rOrwDbWMVB89oKO8hFhhBmc6rQwPkFA34,5555
|
|
24
|
-
apache_airflow_providers_apache_hive-9.0.
|
|
25
|
-
apache_airflow_providers_apache_hive-9.0.
|
|
26
|
-
apache_airflow_providers_apache_hive-9.0.
|
|
27
|
-
apache_airflow_providers_apache_hive-9.0.
|
|
24
|
+
apache_airflow_providers_apache_hive-9.1.0.dist-info/entry_points.txt,sha256=Hzixt33mYYldwmwswarArUB7ZU0xbmUtd3tFViZ414s,185
|
|
25
|
+
apache_airflow_providers_apache_hive-9.1.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
26
|
+
apache_airflow_providers_apache_hive-9.1.0.dist-info/METADATA,sha256=RhQwm3ChWLCvmAuQOh5OetppPh8LVWOgxJR0VjZ3mNs,7104
|
|
27
|
+
apache_airflow_providers_apache_hive-9.1.0.dist-info/RECORD,,
|
|
File without changes
|