apache-airflow-providers-postgres 5.10.1rc1__py3-none-any.whl → 5.10.2__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 +1 -1
- airflow/providers/postgres/datasets/__init__.py +16 -0
- airflow/providers/postgres/datasets/postgres.py +37 -0
- airflow/providers/postgres/get_provider_info.py +8 -1
- airflow/providers/postgres/hooks/postgres.py +7 -7
- {apache_airflow_providers_postgres-5.10.1rc1.dist-info → apache_airflow_providers_postgres-5.10.2.dist-info}/METADATA +8 -8
- apache_airflow_providers_postgres-5.10.2.dist-info/RECORD +13 -0
- apache_airflow_providers_postgres-5.10.1rc1.dist-info/RECORD +0 -11
- {apache_airflow_providers_postgres-5.10.1rc1.dist-info → apache_airflow_providers_postgres-5.10.2.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_postgres-5.10.1rc1.dist-info → apache_airflow_providers_postgres-5.10.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
from __future__ import annotations
|
19
|
+
|
20
|
+
from typing import TYPE_CHECKING
|
21
|
+
|
22
|
+
if TYPE_CHECKING:
|
23
|
+
from urllib.parse import SplitResult
|
24
|
+
|
25
|
+
|
26
|
+
def sanitize_uri(uri: SplitResult) -> SplitResult:
|
27
|
+
if not uri.netloc:
|
28
|
+
raise ValueError("URI format postgres:// must contain a host")
|
29
|
+
if uri.port is None:
|
30
|
+
host = uri.netloc.rstrip(":")
|
31
|
+
uri = uri._replace(netloc=f"{host}:5432")
|
32
|
+
path_parts = uri.path.split("/")
|
33
|
+
if len(path_parts) != 4: # Leading slash, database, schema, and table names.
|
34
|
+
raise ValueError("URI format postgres:// must contain database, schema, and table names")
|
35
|
+
if not path_parts[2]:
|
36
|
+
path_parts[2] = "default"
|
37
|
+
return uri._replace(scheme="postgres", path="/".join(path_parts))
|
@@ -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": 1709556176,
|
32
32
|
"versions": [
|
33
|
+
"5.10.2",
|
33
34
|
"5.10.1",
|
34
35
|
"5.10.0",
|
35
36
|
"5.9.0",
|
@@ -97,4 +98,10 @@ def get_provider_info():
|
|
97
98
|
"connection-type": "postgres",
|
98
99
|
}
|
99
100
|
],
|
101
|
+
"dataset-uris": [
|
102
|
+
{
|
103
|
+
"schemes": ["postgres", "postgresql"],
|
104
|
+
"handler": "airflow.providers.postgres.datasets.postgres.sanitize_uri",
|
105
|
+
}
|
106
|
+
],
|
100
107
|
}
|
@@ -126,7 +126,7 @@ class PostgresHook(DbApiHook):
|
|
126
126
|
raise ValueError(f"Invalid cursor passed {_cursor}. Valid options are: {valid_cursors}")
|
127
127
|
|
128
128
|
def get_conn(self) -> connection:
|
129
|
-
"""
|
129
|
+
"""Establish a connection to a postgres database."""
|
130
130
|
conn_id = getattr(self, self.conn_name_attr)
|
131
131
|
conn = deepcopy(self.connection or self.get_connection(conn_id))
|
132
132
|
|
@@ -162,7 +162,7 @@ class PostgresHook(DbApiHook):
|
|
162
162
|
return self.conn
|
163
163
|
|
164
164
|
def copy_expert(self, sql: str, filename: str) -> None:
|
165
|
-
"""
|
165
|
+
"""Execute SQL using psycopg2's ``copy_expert`` method.
|
166
166
|
|
167
167
|
Necessary to execute COPY command without access to a superuser.
|
168
168
|
|
@@ -193,11 +193,11 @@ class PostgresHook(DbApiHook):
|
|
193
193
|
return uri
|
194
194
|
|
195
195
|
def bulk_load(self, table: str, tmp_file: str) -> None:
|
196
|
-
"""
|
196
|
+
"""Load a tab-delimited file into a database table."""
|
197
197
|
self.copy_expert(f"COPY {table} FROM STDIN", tmp_file)
|
198
198
|
|
199
199
|
def bulk_dump(self, table: str, tmp_file: str) -> None:
|
200
|
-
"""
|
200
|
+
"""Dump a database table into a tab-delimited file."""
|
201
201
|
self.copy_expert(f"COPY {table} TO STDOUT", tmp_file)
|
202
202
|
|
203
203
|
@staticmethod
|
@@ -326,7 +326,7 @@ class PostgresHook(DbApiHook):
|
|
326
326
|
return sql
|
327
327
|
|
328
328
|
def get_openlineage_database_info(self, connection) -> DatabaseInfo:
|
329
|
-
"""
|
329
|
+
"""Return Postgres/Redshift specific information for OpenLineage."""
|
330
330
|
from airflow.providers.openlineage.sqlparser import DatabaseInfo
|
331
331
|
|
332
332
|
is_redshift = connection.extra_dejson.get("redshift", False)
|
@@ -363,11 +363,11 @@ class PostgresHook(DbApiHook):
|
|
363
363
|
return f"{cluster_identifier}.{region_name}:{port}"
|
364
364
|
|
365
365
|
def get_openlineage_database_dialect(self, connection) -> str:
|
366
|
-
"""
|
366
|
+
"""Return postgres/redshift dialect."""
|
367
367
|
return "redshift" if connection.extra_dejson.get("redshift", False) else "postgres"
|
368
368
|
|
369
369
|
def get_openlineage_default_schema(self) -> str | None:
|
370
|
-
"""
|
370
|
+
"""Return current schema. This is usually changed with ``SEARCH_PATH`` parameter."""
|
371
371
|
return self.get_first("SELECT CURRENT_SCHEMA;")[0]
|
372
372
|
|
373
373
|
@classmethod
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: apache-airflow-providers-postgres
|
3
|
-
Version: 5.10.
|
3
|
+
Version: 5.10.2
|
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>
|
@@ -20,15 +20,15 @@ Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
23
|
-
Requires-Dist: apache-airflow-providers-common-sql>=1.3.1
|
24
|
-
Requires-Dist: apache-airflow>=2.6.0
|
23
|
+
Requires-Dist: apache-airflow-providers-common-sql>=1.3.1
|
24
|
+
Requires-Dist: apache-airflow>=2.6.0
|
25
25
|
Requires-Dist: psycopg2-binary>=2.8.0
|
26
26
|
Requires-Dist: apache-airflow-providers-amazon>=2.6.0 ; extra == "amazon"
|
27
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/5.10.
|
31
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.
|
30
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/changelog.html
|
31
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2
|
32
32
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
33
33
|
Project-URL: Source Code, https://github.com/apache/airflow
|
34
34
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
@@ -81,7 +81,7 @@ Provides-Extra: openlineage
|
|
81
81
|
|
82
82
|
Package ``apache-airflow-providers-postgres``
|
83
83
|
|
84
|
-
Release: ``5.10.
|
84
|
+
Release: ``5.10.2``
|
85
85
|
|
86
86
|
|
87
87
|
`PostgreSQL <https://www.postgresql.org/>`__
|
@@ -94,7 +94,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
|
|
94
94
|
are in ``airflow.providers.postgres`` python package.
|
95
95
|
|
96
96
|
You can find package information and changelog for the provider
|
97
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.
|
97
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/>`_.
|
98
98
|
|
99
99
|
Installation
|
100
100
|
------------
|
@@ -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/5.10.
|
141
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/changelog.html>`_.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
airflow/providers/postgres/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
|
2
|
+
airflow/providers/postgres/__init__.py,sha256=my-vOpHPxX8bNXPYr9p5itjxkamH-zBkEaGeTmoAmbQ,1584
|
3
|
+
airflow/providers/postgres/get_provider_info.py,sha256=mXiwHrTxGX5wvFNWeoxKCpY3h8sYMQc4jPcxCsw8cNs,3566
|
4
|
+
airflow/providers/postgres/datasets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
5
|
+
airflow/providers/postgres/datasets/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=L1cPkPcfYAapAYYXibT2hCnSDX1Ek_S1couTMn_8Hk0,15768
|
8
|
+
airflow/providers/postgres/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
9
|
+
airflow/providers/postgres/operators/postgres.py,sha256=pB2mkEh0vOXAr0ANBKJLGSRLSkel815V4vyfET6xG44,3507
|
10
|
+
apache_airflow_providers_postgres-5.10.2.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
|
11
|
+
apache_airflow_providers_postgres-5.10.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
12
|
+
apache_airflow_providers_postgres-5.10.2.dist-info/METADATA,sha256=trSdUvE7y3TpGK7ZxnTIPGSJhB1tI9C4w-EIC0Sl-5c,6555
|
13
|
+
apache_airflow_providers_postgres-5.10.2.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
airflow/providers/postgres/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
|
2
|
-
airflow/providers/postgres/__init__.py,sha256=0qo2QFnNnN3BFndU0MWjASqnUNUk_6LFRyZiZUHWKck,1584
|
3
|
-
airflow/providers/postgres/get_provider_info.py,sha256=O3-FdXvyZLWKXkniheLReeUQ16L_6eOlXByZaQB8NaM,3336
|
4
|
-
airflow/providers/postgres/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
5
|
-
airflow/providers/postgres/hooks/postgres.py,sha256=1Wt6Vy8MaZmQW7QU70OmWn2mYl_SbmeHRgafAZlMMlc,15776
|
6
|
-
airflow/providers/postgres/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
7
|
-
airflow/providers/postgres/operators/postgres.py,sha256=pB2mkEh0vOXAr0ANBKJLGSRLSkel815V4vyfET6xG44,3507
|
8
|
-
apache_airflow_providers_postgres-5.10.1rc1.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
|
9
|
-
apache_airflow_providers_postgres-5.10.1rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
10
|
-
apache_airflow_providers_postgres-5.10.1rc1.dist-info/METADATA,sha256=uXtwxMuy_Yx2DBWbuzKCg-vqwYgtbwXSMSr0l9J7tFQ,6572
|
11
|
-
apache_airflow_providers_postgres-5.10.1rc1.dist-info/RECORD,,
|
File without changes
|