apache-airflow-providers-postgres 5.14.0rc1__py3-none-any.whl → 6.0.0rc1__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/postgres/__init__.py +3 -3
- airflow/providers/postgres/get_provider_info.py +4 -8
- airflow/providers/postgres/hooks/postgres.py +20 -44
- {apache_airflow_providers_postgres-5.14.0rc1.dist-info → apache_airflow_providers_postgres-6.0.0rc1.dist-info}/METADATA +11 -11
- apache_airflow_providers_postgres-6.0.0rc1.dist-info/RECORD +11 -0
- airflow/providers/postgres/operators/__init__.py +0 -17
- airflow/providers/postgres/operators/postgres.py +0 -87
- apache_airflow_providers_postgres-5.14.0rc1.dist-info/RECORD +0 -13
- {apache_airflow_providers_postgres-5.14.0rc1.dist-info → apache_airflow_providers_postgres-6.0.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_postgres-5.14.0rc1.dist-info → apache_airflow_providers_postgres-6.0.0rc1.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__ = "
|
32
|
+
__version__ = "6.0.0"
|
33
33
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
35
|
-
"2.
|
35
|
+
"2.9.0"
|
36
36
|
):
|
37
37
|
raise RuntimeError(
|
38
|
-
f"The package `apache-airflow-providers-postgres:{__version__}` needs Apache Airflow 2.
|
38
|
+
f"The package `apache-airflow-providers-postgres:{__version__}` needs Apache Airflow 2.9.0+"
|
39
39
|
)
|
@@ -28,8 +28,9 @@ def get_provider_info():
|
|
28
28
|
"name": "PostgreSQL",
|
29
29
|
"description": "`PostgreSQL <https://www.postgresql.org/>`__\n",
|
30
30
|
"state": "ready",
|
31
|
-
"source-date-epoch":
|
31
|
+
"source-date-epoch": 1734536300,
|
32
32
|
"versions": [
|
33
|
+
"6.0.0",
|
33
34
|
"5.14.0",
|
34
35
|
"5.13.1",
|
35
36
|
"5.13.0",
|
@@ -72,9 +73,10 @@ def get_provider_info():
|
|
72
73
|
"1.0.0",
|
73
74
|
],
|
74
75
|
"dependencies": [
|
75
|
-
"apache-airflow>=2.
|
76
|
+
"apache-airflow>=2.9.0",
|
76
77
|
"apache-airflow-providers-common-sql>=1.20.0",
|
77
78
|
"psycopg2-binary>=2.9.4",
|
79
|
+
"asyncpg>=0.30.0",
|
78
80
|
],
|
79
81
|
"additional-extras": [{"name": "amazon", "dependencies": ["apache-airflow-providers-amazon>=2.6.0"]}],
|
80
82
|
"integrations": [
|
@@ -88,12 +90,6 @@ def get_provider_info():
|
|
88
90
|
"tags": ["software"],
|
89
91
|
}
|
90
92
|
],
|
91
|
-
"operators": [
|
92
|
-
{
|
93
|
-
"integration-name": "PostgreSQL",
|
94
|
-
"python-modules": ["airflow.providers.postgres.operators.postgres"],
|
95
|
-
}
|
96
|
-
],
|
97
93
|
"hooks": [
|
98
94
|
{
|
99
95
|
"integration-name": "PostgreSQL",
|
@@ -18,19 +18,18 @@
|
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
20
|
import os
|
21
|
-
import
|
21
|
+
from collections.abc import Iterable
|
22
22
|
from contextlib import closing
|
23
23
|
from copy import deepcopy
|
24
|
-
from typing import TYPE_CHECKING, Any,
|
24
|
+
from typing import TYPE_CHECKING, Any, Union
|
25
25
|
|
26
26
|
import psycopg2
|
27
27
|
import psycopg2.extensions
|
28
28
|
import psycopg2.extras
|
29
|
-
from deprecated import deprecated
|
30
29
|
from psycopg2.extras import DictCursor, NamedTupleCursor, RealDictCursor
|
31
30
|
from sqlalchemy.engine import URL
|
32
31
|
|
33
|
-
from airflow.exceptions import
|
32
|
+
from airflow.exceptions import AirflowException
|
34
33
|
from airflow.providers.common.sql.hooks.sql import DbApiHook
|
35
34
|
|
36
35
|
if TYPE_CHECKING:
|
@@ -87,49 +86,33 @@ class PostgresHook(DbApiHook):
|
|
87
86
|
hook_name = "Postgres"
|
88
87
|
supports_autocommit = True
|
89
88
|
supports_executemany = True
|
89
|
+
ignored_extra_options = {
|
90
|
+
"iam",
|
91
|
+
"redshift",
|
92
|
+
"redshift-serverless",
|
93
|
+
"cursor",
|
94
|
+
"cluster-identifier",
|
95
|
+
"workgroup-name",
|
96
|
+
"aws_conn_id",
|
97
|
+
"sqlalchemy_scheme",
|
98
|
+
"sqlalchemy_query",
|
99
|
+
}
|
90
100
|
|
91
101
|
def __init__(
|
92
102
|
self, *args, options: str | None = None, enable_log_db_messages: bool = False, **kwargs
|
93
103
|
) -> None:
|
94
|
-
if "schema" in kwargs:
|
95
|
-
warnings.warn(
|
96
|
-
'The "schema" arg has been renamed to "database" as it contained the database name.'
|
97
|
-
'Please use "database" to set the database name.',
|
98
|
-
AirflowProviderDeprecationWarning,
|
99
|
-
stacklevel=2,
|
100
|
-
)
|
101
|
-
kwargs["database"] = kwargs["schema"]
|
102
104
|
super().__init__(*args, **kwargs)
|
103
105
|
self.conn: connection = None
|
104
106
|
self.database: str | None = kwargs.pop("database", None)
|
105
107
|
self.options = options
|
106
108
|
self.enable_log_db_messages = enable_log_db_messages
|
107
109
|
|
108
|
-
@property
|
109
|
-
@deprecated(
|
110
|
-
reason=(
|
111
|
-
'The "schema" variable has been renamed to "database" as it contained the database name.'
|
112
|
-
'Please use "database" to get the database name.'
|
113
|
-
),
|
114
|
-
category=AirflowProviderDeprecationWarning,
|
115
|
-
)
|
116
|
-
def schema(self):
|
117
|
-
return self.database
|
118
|
-
|
119
|
-
@schema.setter
|
120
|
-
@deprecated(
|
121
|
-
reason=(
|
122
|
-
'The "schema" variable has been renamed to "database" as it contained the database name.'
|
123
|
-
'Please use "database" to set the database name.'
|
124
|
-
),
|
125
|
-
category=AirflowProviderDeprecationWarning,
|
126
|
-
)
|
127
|
-
def schema(self, value):
|
128
|
-
self.database = value
|
129
|
-
|
130
110
|
@property
|
131
111
|
def sqlalchemy_url(self) -> URL:
|
132
|
-
conn = self.
|
112
|
+
conn = self.connection
|
113
|
+
query = conn.extra_dejson.get("sqlalchemy_query", {})
|
114
|
+
if not isinstance(query, dict):
|
115
|
+
raise AirflowException("The parameter 'sqlalchemy_query' must be of type dict!")
|
133
116
|
return URL.create(
|
134
117
|
drivername="postgresql",
|
135
118
|
username=conn.login,
|
@@ -137,6 +120,7 @@ class PostgresHook(DbApiHook):
|
|
137
120
|
host=conn.host,
|
138
121
|
port=conn.port,
|
139
122
|
database=self.database or conn.schema,
|
123
|
+
query=query,
|
140
124
|
)
|
141
125
|
|
142
126
|
def _get_cursor(self, raw_cursor: str) -> CursorType:
|
@@ -175,15 +159,7 @@ class PostgresHook(DbApiHook):
|
|
175
159
|
conn_args["options"] = self.options
|
176
160
|
|
177
161
|
for arg_name, arg_val in conn.extra_dejson.items():
|
178
|
-
if arg_name not in
|
179
|
-
"iam",
|
180
|
-
"redshift",
|
181
|
-
"redshift-serverless",
|
182
|
-
"cursor",
|
183
|
-
"cluster-identifier",
|
184
|
-
"workgroup-name",
|
185
|
-
"aws_conn_id",
|
186
|
-
]:
|
162
|
+
if arg_name not in self.ignored_extra_options:
|
187
163
|
conn_args[arg_name] = arg_val
|
188
164
|
|
189
165
|
self.conn = psycopg2.connect(**conn_args)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: apache-airflow-providers-postgres
|
3
|
-
Version:
|
3
|
+
Version: 6.0.0rc1
|
4
4
|
Summary: Provider package apache-airflow-providers-postgres for Apache Airflow
|
5
5
|
Keywords: airflow-provider,postgres,airflow,integration
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
@@ -21,20 +21,19 @@ Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
23
23
|
Requires-Dist: apache-airflow-providers-common-sql>=1.20.0rc0
|
24
|
-
Requires-Dist: apache-airflow>=2.
|
24
|
+
Requires-Dist: apache-airflow>=2.9.0rc0
|
25
|
+
Requires-Dist: asyncpg>=0.30.0
|
25
26
|
Requires-Dist: psycopg2-binary>=2.9.4
|
26
27
|
Requires-Dist: apache-airflow-providers-amazon>=2.6.0rc0 ; extra == "amazon"
|
27
|
-
Requires-Dist: apache-airflow-providers-common-sql ; extra == "common-sql"
|
28
28
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
29
29
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
30
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/
|
31
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/
|
30
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.0.0/changelog.html
|
31
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.0.0
|
32
32
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
33
33
|
Project-URL: Source Code, https://github.com/apache/airflow
|
34
|
-
Project-URL: Twitter, https://
|
34
|
+
Project-URL: Twitter, https://x.com/ApacheAirflow
|
35
35
|
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
36
36
|
Provides-Extra: amazon
|
37
|
-
Provides-Extra: common-sql
|
38
37
|
Provides-Extra: openlineage
|
39
38
|
|
40
39
|
|
@@ -81,7 +80,7 @@ Provides-Extra: openlineage
|
|
81
80
|
|
82
81
|
Package ``apache-airflow-providers-postgres``
|
83
82
|
|
84
|
-
Release: ``
|
83
|
+
Release: ``6.0.0.rc1``
|
85
84
|
|
86
85
|
|
87
86
|
`PostgreSQL <https://www.postgresql.org/>`__
|
@@ -94,7 +93,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
|
|
94
93
|
are in ``airflow.providers.postgres`` python package.
|
95
94
|
|
96
95
|
You can find package information and changelog for the provider
|
97
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/
|
96
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.0.0/>`_.
|
98
97
|
|
99
98
|
Installation
|
100
99
|
------------
|
@@ -111,9 +110,10 @@ Requirements
|
|
111
110
|
======================================= ==================
|
112
111
|
PIP package Version required
|
113
112
|
======================================= ==================
|
114
|
-
``apache-airflow`` ``>=2.
|
113
|
+
``apache-airflow`` ``>=2.9.0``
|
115
114
|
``apache-airflow-providers-common-sql`` ``>=1.20.0``
|
116
115
|
``psycopg2-binary`` ``>=2.9.4``
|
116
|
+
``asyncpg`` ``>=0.30.0``
|
117
117
|
======================================= ==================
|
118
118
|
|
119
119
|
Cross provider package dependencies
|
@@ -138,4 +138,4 @@ Dependent package
|
|
138
138
|
============================================================================================================== ===============
|
139
139
|
|
140
140
|
The changelog for the provider package can be found in the
|
141
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/
|
141
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.0.0/changelog.html>`_.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
airflow/providers/postgres/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
|
2
|
+
airflow/providers/postgres/__init__.py,sha256=Fot2q5J0MqxTT660Ulle4BC-yXNhsHyHl6fHbkmjEdM,1495
|
3
|
+
airflow/providers/postgres/get_provider_info.py,sha256=dW-WC9XPDvGPfbhPilsb5igbOO2HGUGq0p2o0g9PPSw,3800
|
4
|
+
airflow/providers/postgres/assets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
5
|
+
airflow/providers/postgres/assets/postgres.py,sha256=XNhOJCbOA_soaaiS73JjULMqAM_7PBryhToe8FJREA0,1522
|
6
|
+
airflow/providers/postgres/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
7
|
+
airflow/providers/postgres/hooks/postgres.py,sha256=h7eGDkg8sYpgVwAXFC72pWNKT6oxZK6hCUGtgae5S3U,17531
|
8
|
+
apache_airflow_providers_postgres-6.0.0rc1.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
|
9
|
+
apache_airflow_providers_postgres-6.0.0rc1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
10
|
+
apache_airflow_providers_postgres-6.0.0rc1.dist-info/METADATA,sha256=Tv4HGI47ayQAAXi7dTL-UaNxzrKuoHjibjWs-SiHjX4,6546
|
11
|
+
apache_airflow_providers_postgres-6.0.0rc1.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
4
|
-
# distributed with this work for additional information
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
7
|
-
# "License"); you may not use this file except in compliance
|
8
|
-
# with the License. You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
13
|
-
# software distributed under the License is distributed on an
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
# KIND, either express or implied. See the License for the
|
16
|
-
# specific language governing permissions and limitations
|
17
|
-
# under the License.
|
@@ -1,87 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
4
|
-
# distributed with this work for additional information
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
7
|
-
# "License"); you may not use this file except in compliance
|
8
|
-
# with the License. You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
13
|
-
# software distributed under the License is distributed on an
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
# KIND, either express or implied. See the License for the
|
16
|
-
# specific language governing permissions and limitations
|
17
|
-
# under the License.
|
18
|
-
from __future__ import annotations
|
19
|
-
|
20
|
-
import warnings
|
21
|
-
from typing import ClassVar, Mapping
|
22
|
-
|
23
|
-
from deprecated import deprecated
|
24
|
-
|
25
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
26
|
-
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
|
27
|
-
|
28
|
-
|
29
|
-
@deprecated(
|
30
|
-
reason=(
|
31
|
-
"Please use `airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`."
|
32
|
-
"Also, you can provide `hook_params={'schema': <database>}`."
|
33
|
-
),
|
34
|
-
category=AirflowProviderDeprecationWarning,
|
35
|
-
)
|
36
|
-
class PostgresOperator(SQLExecuteQueryOperator):
|
37
|
-
"""
|
38
|
-
Executes sql code in a specific Postgres database.
|
39
|
-
|
40
|
-
This class is deprecated.
|
41
|
-
|
42
|
-
Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.
|
43
|
-
|
44
|
-
:param sql: the SQL code to be executed as a single string, or
|
45
|
-
a list of str (sql statements), or a reference to a template file.
|
46
|
-
Template references are recognized by str ending in '.sql'
|
47
|
-
:param postgres_conn_id: The :ref:`postgres conn id <howto/connection:postgres>`
|
48
|
-
reference to a specific postgres database.
|
49
|
-
:param autocommit: if True, each command is automatically committed.
|
50
|
-
(default value: False)
|
51
|
-
:param parameters: (optional) the parameters to render the SQL query with.
|
52
|
-
:param database: name of database which overwrite defined one in connection
|
53
|
-
:param runtime_parameters: a mapping of runtime params added to the final sql being executed.
|
54
|
-
For example, you could set the schema via `{"search_path": "CUSTOM_SCHEMA"}`.
|
55
|
-
Deprecated - use `hook_params={'options': '-c <connection_options>'}` instead.
|
56
|
-
"""
|
57
|
-
|
58
|
-
template_fields_renderers: ClassVar[dict] = {
|
59
|
-
**SQLExecuteQueryOperator.template_fields_renderers,
|
60
|
-
"sql": "postgresql",
|
61
|
-
}
|
62
|
-
ui_color = "#ededed"
|
63
|
-
|
64
|
-
def __init__(
|
65
|
-
self,
|
66
|
-
*,
|
67
|
-
postgres_conn_id: str = "postgres_default",
|
68
|
-
database: str | None = None,
|
69
|
-
runtime_parameters: Mapping | None = None,
|
70
|
-
**kwargs,
|
71
|
-
) -> None:
|
72
|
-
if database is not None:
|
73
|
-
hook_params = kwargs.pop("hook_params", {})
|
74
|
-
kwargs["hook_params"] = {"database": database, **hook_params}
|
75
|
-
|
76
|
-
if runtime_parameters:
|
77
|
-
warnings.warn(
|
78
|
-
"""`runtime_parameters` is deprecated.
|
79
|
-
Please use `hook_params={'options': '-c <connection_options>}`.""",
|
80
|
-
AirflowProviderDeprecationWarning,
|
81
|
-
stacklevel=2,
|
82
|
-
)
|
83
|
-
hook_params = kwargs.pop("hook_params", {})
|
84
|
-
options = " ".join(f"-c {param}={val}" for param, val in runtime_parameters.items())
|
85
|
-
kwargs["hook_params"] = {"options": options, **hook_params}
|
86
|
-
|
87
|
-
super().__init__(conn_id=postgres_conn_id, **kwargs)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
airflow/providers/postgres/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
|
2
|
-
airflow/providers/postgres/__init__.py,sha256=VnUmUbfP12iJQKXxosuS_8zJJB288x3BQU8jUPuZONQ,1496
|
3
|
-
airflow/providers/postgres/get_provider_info.py,sha256=he8tks-iUep0xlL9MuRTMyjcfbj8_a9SPvi7BVmTkW0,3945
|
4
|
-
airflow/providers/postgres/assets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
5
|
-
airflow/providers/postgres/assets/postgres.py,sha256=XNhOJCbOA_soaaiS73JjULMqAM_7PBryhToe8FJREA0,1522
|
6
|
-
airflow/providers/postgres/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
7
|
-
airflow/providers/postgres/hooks/postgres.py,sha256=0sJm85AhKmXrKHrgpG9GexLo0F_nRcjgC5i-gc5qOuM,18377
|
8
|
-
airflow/providers/postgres/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
9
|
-
airflow/providers/postgres/operators/postgres.py,sha256=SWhsQlwcT434NH32Z45rivAQhGFMlFXwPn1JSc1iQsk,3558
|
10
|
-
apache_airflow_providers_postgres-5.14.0rc1.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
|
11
|
-
apache_airflow_providers_postgres-5.14.0rc1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
12
|
-
apache_airflow_providers_postgres-5.14.0rc1.dist-info/METADATA,sha256=D93aTOl1EVl9NP3vxcCdZdEYnWuaZrtftpL6JmsR-2k,6575
|
13
|
-
apache_airflow_providers_postgres-5.14.0rc1.dist-info/RECORD,,
|
File without changes
|