apache-airflow-providers-postgres 5.10.1rc1__tar.gz → 5.10.2__tar.gz

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.
Files changed (12) hide show
  1. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/PKG-INFO +8 -8
  2. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/README.rst +3 -3
  3. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/__init__.py +1 -1
  4. apache_airflow_providers_postgres-5.10.2/airflow/providers/postgres/datasets/__init__.py +16 -0
  5. apache_airflow_providers_postgres-5.10.2/airflow/providers/postgres/datasets/postgres.py +37 -0
  6. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/get_provider_info.py +8 -1
  7. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/hooks/postgres.py +7 -7
  8. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/pyproject.toml +5 -5
  9. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/LICENSE +0 -0
  10. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/hooks/__init__.py +0 -0
  11. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/operators/__init__.py +0 -0
  12. {apache_airflow_providers_postgres-5.10.1rc1 → apache_airflow_providers_postgres-5.10.2}/airflow/providers/postgres/operators/postgres.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-postgres
3
- Version: 5.10.1rc1
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.dev0
24
- Requires-Dist: apache-airflow>=2.6.0.dev0
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.1/changelog.html
31
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.1
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.1.rc1``
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.1/>`_.
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.1/changelog.html>`_.
141
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/changelog.html>`_.
@@ -42,7 +42,7 @@
42
42
 
43
43
  Package ``apache-airflow-providers-postgres``
44
44
 
45
- Release: ``5.10.1.rc1``
45
+ Release: ``5.10.2``
46
46
 
47
47
 
48
48
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -55,7 +55,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
55
55
  are in ``airflow.providers.postgres`` python package.
56
56
 
57
57
  You can find package information and changelog for the provider
58
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.1/>`_.
58
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/>`_.
59
59
 
60
60
  Installation
61
61
  ------------
@@ -99,4 +99,4 @@ Dependent package
99
99
  ============================================================================================================== ===============
100
100
 
101
101
  The changelog for the provider package can be found in the
102
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.1/changelog.html>`_.
102
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/changelog.html>`_.
@@ -27,7 +27,7 @@ import packaging.version
27
27
 
28
28
  __all__ = ["__version__"]
29
29
 
30
- __version__ = "5.10.1"
30
+ __version__ = "5.10.2"
31
31
 
32
32
  try:
33
33
  from airflow import __version__ as airflow_version
@@ -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": 1707636481,
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
- """Establishes a connection to a postgres database."""
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
- """Executes SQL using psycopg2's ``copy_expert`` method.
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
- """Loads a tab-delimited file into a database table."""
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
- """Dumps a database table into a tab-delimited file."""
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
- """Returns Postgres/Redshift specific information for OpenLineage."""
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
- """Returns postgres/redshift dialect."""
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
- """Returns current schema. This is usually changed with ``SEARCH_PATH`` parameter."""
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
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
28
28
 
29
29
  [project]
30
30
  name = "apache-airflow-providers-postgres"
31
- version = "5.10.1.rc1"
31
+ version = "5.10.2"
32
32
  description = "Provider package apache-airflow-providers-postgres for Apache Airflow"
33
33
  readme = "README.rst"
34
34
  authors = [
@@ -55,14 +55,14 @@ classifiers = [
55
55
  ]
56
56
  requires-python = "~=3.8"
57
57
  dependencies = [
58
- "apache-airflow-providers-common-sql>=1.3.1.dev0",
59
- "apache-airflow>=2.6.0.dev0",
58
+ "apache-airflow-providers-common-sql>=1.3.1",
59
+ "apache-airflow>=2.6.0",
60
60
  "psycopg2-binary>=2.8.0",
61
61
  ]
62
62
 
63
63
  [project.urls]
64
- "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.1"
65
- "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.1/changelog.html"
64
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2"
65
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.10.2/changelog.html"
66
66
  "Bug Tracker" = "https://github.com/apache/airflow/issues"
67
67
  "Source Code" = "https://github.com/apache/airflow"
68
68
  "Slack Chat" = "https://s.apache.org/airflow-slack"