apache-airflow-providers-postgres 5.5.2rc2__tar.gz → 5.6.0__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 (21) hide show
  1. {apache-airflow-providers-postgres-5.5.2rc2/apache_airflow_providers_postgres.egg-info → apache-airflow-providers-postgres-5.6.0}/PKG-INFO +14 -12
  2. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/README.rst +10 -9
  3. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/__init__.py +4 -2
  4. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/get_provider_info.py +1 -0
  5. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/hooks/postgres.py +47 -1
  6. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/operators/postgres.py +4 -0
  7. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0/apache_airflow_providers_postgres.egg-info}/PKG-INFO +14 -12
  8. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/requires.txt +5 -2
  9. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/pyproject.toml +5 -28
  10. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/setup.cfg +5 -5
  11. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/setup.py +2 -1
  12. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/LICENSE +0 -0
  13. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/MANIFEST.in +0 -0
  14. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/NOTICE +0 -0
  15. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/hooks/__init__.py +0 -0
  16. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/airflow/providers/postgres/operators/__init__.py +0 -0
  17. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/SOURCES.txt +0 -0
  18. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/dependency_links.txt +0 -0
  19. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/entry_points.txt +0 -0
  20. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/not-zip-safe +0 -0
  21. {apache-airflow-providers-postgres-5.5.2rc2 → apache-airflow-providers-postgres-5.6.0}/apache_airflow_providers_postgres.egg-info/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-postgres
3
- Version: 5.5.2rc2
3
+ Version: 5.6.0
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-postgres package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -31,6 +31,7 @@ Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
32
  Provides-Extra: amazon
33
33
  Provides-Extra: common.sql
34
+ Provides-Extra: openlineage
34
35
  License-File: LICENSE
35
36
  License-File: NOTICE
36
37
 
@@ -72,7 +73,7 @@ License-File: NOTICE
72
73
 
73
74
  Package ``apache-airflow-providers-postgres``
74
75
 
75
- Release: ``5.5.2rc2``
76
+ Release: ``5.6.0``
76
77
 
77
78
 
78
79
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -85,7 +86,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
85
86
  are in ``airflow.providers.postgres`` python package.
86
87
 
87
88
  You can find package information and changelog for the provider
88
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/>`_.
89
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/>`_.
89
90
 
90
91
 
91
92
  Installation
@@ -121,12 +122,13 @@ You can install such cross-provider dependencies when installing from PyPI. For
121
122
  pip install apache-airflow-providers-postgres[amazon]
122
123
 
123
124
 
124
- ============================================================================================================ ==============
125
- Dependent package Extra
126
- ============================================================================================================ ==============
127
- `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
128
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
129
- ============================================================================================================ ==============
125
+ ============================================================================================================== ===============
126
+ Dependent package Extra
127
+ ============================================================================================================== ===============
128
+ `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
129
+ `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
130
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
131
+ ============================================================================================================== ===============
130
132
 
131
133
  The changelog for the provider package can be found in the
132
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html>`_.
134
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html>`_.
@@ -36,7 +36,7 @@
36
36
 
37
37
  Package ``apache-airflow-providers-postgres``
38
38
 
39
- Release: ``5.5.2rc2``
39
+ Release: ``5.6.0``
40
40
 
41
41
 
42
42
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -49,7 +49,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
49
49
  are in ``airflow.providers.postgres`` python package.
50
50
 
51
51
  You can find package information and changelog for the provider
52
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/>`_.
52
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/>`_.
53
53
 
54
54
 
55
55
  Installation
@@ -85,12 +85,13 @@ You can install such cross-provider dependencies when installing from PyPI. For
85
85
  pip install apache-airflow-providers-postgres[amazon]
86
86
 
87
87
 
88
- ============================================================================================================ ==============
89
- Dependent package Extra
90
- ============================================================================================================ ==============
91
- `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
92
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
93
- ============================================================================================================ ==============
88
+ ============================================================================================================== ===============
89
+ Dependent package Extra
90
+ ============================================================================================================== ===============
91
+ `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
92
+ `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
93
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
94
+ ============================================================================================================== ===============
94
95
 
95
96
  The changelog for the provider package can be found in the
96
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html>`_.
97
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html>`_.
@@ -28,14 +28,16 @@ import packaging.version
28
28
 
29
29
  __all__ = ["__version__"]
30
30
 
31
- __version__ = "5.5.2"
31
+ __version__ = "5.6.0"
32
32
 
33
33
  try:
34
34
  from airflow import __version__ as airflow_version
35
35
  except ImportError:
36
36
  from airflow.version import version as airflow_version
37
37
 
38
- if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
38
+ if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
39
+ "2.4.0"
40
+ ):
39
41
  raise RuntimeError(
40
42
  f"The package `apache-airflow-providers-postgres:{__version__}` requires Apache Airflow 2.4.0+" # NOQA: E501
41
43
  )
@@ -29,6 +29,7 @@ def get_provider_info():
29
29
  "description": "`PostgreSQL <https://www.postgresql.org/>`__\n",
30
30
  "suspended": False,
31
31
  "versions": [
32
+ "5.6.0",
32
33
  "5.5.2",
33
34
  "5.5.1",
34
35
  "5.5.0",
@@ -21,7 +21,7 @@ import os
21
21
  import warnings
22
22
  from contextlib import closing
23
23
  from copy import deepcopy
24
- from typing import Any, Iterable, Union
24
+ from typing import TYPE_CHECKING, Any, Iterable, Union
25
25
 
26
26
  import psycopg2
27
27
  import psycopg2.extensions
@@ -33,6 +33,9 @@ from airflow.exceptions import AirflowProviderDeprecationWarning
33
33
  from airflow.models.connection import Connection
34
34
  from airflow.providers.common.sql.hooks.sql import DbApiHook
35
35
 
36
+ if TYPE_CHECKING:
37
+ from airflow.providers.openlineage.sqlparser import DatabaseInfo
38
+
36
39
  CursorType = Union[DictCursor, RealDictCursor, NamedTupleCursor]
37
40
 
38
41
 
@@ -317,3 +320,46 @@ class PostgresHook(DbApiHook):
317
320
  sql += f"{on_conflict_str} DO NOTHING"
318
321
 
319
322
  return sql
323
+
324
+ def get_openlineage_database_info(self, connection) -> DatabaseInfo:
325
+ """Returns Postgres/Redshift specific information for OpenLineage."""
326
+ from airflow.providers.openlineage.sqlparser import DatabaseInfo
327
+
328
+ is_redshift = connection.extra_dejson.get("redshift", False)
329
+
330
+ if is_redshift:
331
+ authority = self._get_openlineage_redshift_authority_part(connection)
332
+ else:
333
+ authority = DbApiHook.get_openlineage_authority_part(connection, default_port=5432)
334
+
335
+ return DatabaseInfo(
336
+ scheme="postgres" if not is_redshift else "redshift",
337
+ authority=authority,
338
+ database=self.database or connection.schema,
339
+ )
340
+
341
+ def _get_openlineage_redshift_authority_part(self, connection) -> str:
342
+ try:
343
+ from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
344
+ except ImportError:
345
+ from airflow.exceptions import AirflowException
346
+
347
+ raise AirflowException(
348
+ "apache-airflow-providers-amazon not installed, run: "
349
+ "pip install 'apache-airflow-providers-postgres[amazon]'."
350
+ )
351
+ aws_conn_id = connection.extra_dejson.get("aws_conn_id", "aws_default")
352
+
353
+ port = connection.port or 5439
354
+ cluster_identifier = connection.extra_dejson.get("cluster-identifier", connection.host.split(".")[0])
355
+ region_name = AwsBaseHook(aws_conn_id=aws_conn_id).region_name
356
+
357
+ return f"{cluster_identifier}.{region_name}:{port}"
358
+
359
+ def get_openlineage_database_dialect(self, connection) -> str:
360
+ """Returns postgres/redshift dialect."""
361
+ return "redshift" if connection.extra_dejson.get("redshift", False) else "postgres"
362
+
363
+ def get_openlineage_default_schema(self) -> str | None:
364
+ """Returns current schema. This is usually changed with ``SEARCH_PATH`` parameter."""
365
+ return self.get_first("SELECT CURRENT_SCHEMA;")[0]
@@ -28,6 +28,10 @@ class PostgresOperator(SQLExecuteQueryOperator):
28
28
  """
29
29
  Executes sql code in a specific Postgres database.
30
30
 
31
+ This class is deprecated.
32
+
33
+ Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.
34
+
31
35
  :param sql: the SQL code to be executed as a single string, or
32
36
  a list of str (sql statements), or a reference to a template file.
33
37
  Template references are recognized by str ending in '.sql'
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-postgres
3
- Version: 5.5.2rc2
3
+ Version: 5.6.0
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-postgres package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -31,6 +31,7 @@ Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
32
  Provides-Extra: amazon
33
33
  Provides-Extra: common.sql
34
+ Provides-Extra: openlineage
34
35
  License-File: LICENSE
35
36
  License-File: NOTICE
36
37
 
@@ -72,7 +73,7 @@ License-File: NOTICE
72
73
 
73
74
  Package ``apache-airflow-providers-postgres``
74
75
 
75
- Release: ``5.5.2rc2``
76
+ Release: ``5.6.0``
76
77
 
77
78
 
78
79
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -85,7 +86,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
85
86
  are in ``airflow.providers.postgres`` python package.
86
87
 
87
88
  You can find package information and changelog for the provider
88
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/>`_.
89
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/>`_.
89
90
 
90
91
 
91
92
  Installation
@@ -121,12 +122,13 @@ You can install such cross-provider dependencies when installing from PyPI. For
121
122
  pip install apache-airflow-providers-postgres[amazon]
122
123
 
123
124
 
124
- ============================================================================================================ ==============
125
- Dependent package Extra
126
- ============================================================================================================ ==============
127
- `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
128
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
129
- ============================================================================================================ ==============
125
+ ============================================================================================================== ===============
126
+ Dependent package Extra
127
+ ============================================================================================================== ===============
128
+ `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
129
+ `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
130
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
131
+ ============================================================================================================== ===============
130
132
 
131
133
  The changelog for the provider package can be found in the
132
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html>`_.
134
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html>`_.
@@ -1,5 +1,5 @@
1
- apache-airflow-providers-common-sql>=1.3.1.dev0
2
- apache-airflow>=2.4.0.dev0
1
+ apache-airflow-providers-common-sql>=1.3.1
2
+ apache-airflow>=2.4.0
3
3
  psycopg2-binary>=2.8.0
4
4
 
5
5
  [amazon]
@@ -7,3 +7,6 @@ apache-airflow-providers-amazon>=2.6.0
7
7
 
8
8
  [common.sql]
9
9
  apache-airflow-providers-common-sql
10
+
11
+ [openlineage]
12
+ apache-airflow-providers-openlineage
@@ -41,7 +41,8 @@ extend-exclude = [
41
41
  # The files generated by stubgen aren't 100% valid syntax it turns out, and we don't ship them, so we can
42
42
  # ignore them in ruff
43
43
  "airflow/providers/common/sql/*/*.pyi",
44
- "airflow/migrations/versions/*.py"
44
+ "airflow/migrations/versions/*.py",
45
+ "tests/dags/test_imports.py",
45
46
  ]
46
47
 
47
48
  extend-select = [
@@ -73,6 +74,8 @@ extend-ignore = [
73
74
  "E731",
74
75
  ]
75
76
 
77
+ namespace-packages = ["airflow/providers"]
78
+
76
79
  [tool.pytest.ini_options]
77
80
  # * Disable `flaky` plugin for pytest. This plugin conflicts with `rerunfailures` because provide same marker.
78
81
  # * Disable `nose` builtin plugin for pytest. This feature deprecated in 7.2 and will be removed in pytest>=8
@@ -99,46 +102,20 @@ filterwarnings = [
99
102
  "ignore::DeprecationWarning:apispec.utils",
100
103
  ]
101
104
  python_files = [
102
- "*.py",
105
+ "test_*.py",
103
106
  ]
104
107
  testpaths = [
105
108
  "tests",
106
109
  ]
107
110
 
108
111
  [tool.ruff.isort]
109
- known-first-party = ["airflow", "airflow_breeze", "docker_tests", "docs", "kubernetes_tests", "tests"]
110
112
  required-imports = ["from __future__ import annotations"]
111
113
  combine-as-imports = true
112
114
 
113
- # TODO: for now, https://github.com/charliermarsh/ruff/issues/1817
114
- known-third-party = [
115
- "asana",
116
- "atlassian",
117
- "celery",
118
- "cloudant",
119
- "databricks",
120
- "datadog",
121
- "docker",
122
- "elasticsearch",
123
- "github",
124
- "google",
125
- "grpc",
126
- "jenkins",
127
- "mysql",
128
- "neo4j",
129
- "papermill",
130
- "redis",
131
- "sendgrid",
132
- "snowflake",
133
- "telegram",
134
- "trino",
135
- ]
136
-
137
115
  [tool.ruff.per-file-ignores]
138
116
  "airflow/models/__init__.py" = ["F401"]
139
117
  "airflow/models/sqla_models.py" = ["F401"]
140
118
 
141
-
142
119
  # The test_python.py is needed because adding __future__.annotations breaks runtime checks that are
143
120
  # needed for the test to work
144
121
  "tests/decorators/test_python.py" = ["I002"]
@@ -27,8 +27,8 @@ classifiers =
27
27
  Programming Language :: Python :: 3.11
28
28
  Topic :: System :: Monitoring
29
29
  project_urls =
30
- Documentation=https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/
31
- Changelog=https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.5.2/changelog.html
30
+ Documentation=https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/
31
+ Changelog=https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.6.0/changelog.html
32
32
  Bug Tracker=https://github.com/apache/airflow/issues
33
33
  Source Code=https://github.com/apache/airflow
34
34
  Slack Chat=https://s.apache.org/airflow-slack
@@ -47,8 +47,8 @@ setup_requires =
47
47
  setuptools
48
48
  wheel
49
49
  install_requires =
50
- apache-airflow-providers-common-sql>=1.3.1.dev0
51
- apache-airflow>=2.4.0.dev0
50
+ apache-airflow-providers-common-sql>=1.3.1
51
+ apache-airflow>=2.4.0
52
52
  psycopg2-binary>=2.8.0
53
53
 
54
54
  [options.entry_points]
@@ -59,6 +59,6 @@ apache_airflow_provider =
59
59
  packages = airflow.providers.postgres
60
60
 
61
61
  [egg_info]
62
- tag_build = rc2
62
+ tag_build =
63
63
  tag_date = 0
64
64
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  from setuptools import find_namespace_packages, setup
28
28
 
29
- version = "5.5.2"
29
+ version = "5.6.0"
30
30
 
31
31
 
32
32
  def do_setup():
@@ -36,6 +36,7 @@ def do_setup():
36
36
  extras_require={
37
37
  "amazon": ["apache-airflow-providers-amazon>=2.6.0"],
38
38
  "common.sql": ["apache-airflow-providers-common-sql"],
39
+ "openlineage": ["apache-airflow-providers-openlineage"],
39
40
  },
40
41
  packages=find_namespace_packages(
41
42
  include=[