apache-airflow-providers-postgres 6.8.0__tar.gz → 7.0.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 (43) hide show
  1. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/PKG-INFO +19 -14
  2. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/README.rst +9 -8
  3. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/changelog.rst +50 -0
  4. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/index.rst +31 -7
  5. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/operators.rst +1 -1
  6. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/provider.yaml +2 -1
  7. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/pyproject.toml +20 -6
  8. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/__init__.py +1 -1
  9. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/hooks/postgres.py +39 -23
  10. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/hooks/test_postgres.py +21 -0
  11. apache_airflow_providers_postgres-7.0.0/tests/unit/postgres/test_provider_dependencies.py +46 -0
  12. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/.gitignore +0 -0
  13. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/LICENSE +0 -0
  14. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/NOTICE +0 -0
  15. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/.latest-doc-only-change.txt +0 -0
  16. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/commits.rst +0 -0
  17. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/conf.py +0 -0
  18. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/configurations-ref.rst +0 -0
  19. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/connections/postgres.rst +0 -0
  20. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/dialects.rst +0 -0
  21. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/installing-providers-from-sources.rst +0 -0
  22. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/integration-logos/Postgres.png +0 -0
  23. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/redirects.txt +0 -0
  24. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/docs/security.rst +0 -0
  25. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/__init__.py +0 -0
  26. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/__init__.py +0 -0
  27. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/assets/__init__.py +0 -0
  28. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/assets/postgres.py +0 -0
  29. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/dialects/__init__.py +0 -0
  30. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/dialects/postgres.py +0 -0
  31. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/get_provider_info.py +0 -0
  32. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/src/airflow/providers/postgres/hooks/__init__.py +0 -0
  33. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/conftest.py +0 -0
  34. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/system/__init__.py +0 -0
  35. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/system/postgres/__init__.py +0 -0
  36. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/system/postgres/example_postgres.py +0 -0
  37. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/__init__.py +0 -0
  38. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/__init__.py +0 -0
  39. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/assets/__init__.py +0 -0
  40. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/assets/test_postgres.py +0 -0
  41. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/dialects/__init__.py +0 -0
  42. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/dialects/test_postgres.py +0 -0
  43. {apache_airflow_providers_postgres-6.8.0 → apache_airflow_providers_postgres-7.0.0}/tests/unit/postgres/hooks/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-postgres
3
- Version: 6.8.0
3
+ Version: 7.0.0
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>
@@ -26,32 +26,36 @@ License-File: NOTICE
26
26
  Requires-Dist: apache-airflow>=2.11.0
27
27
  Requires-Dist: apache-airflow-providers-common-compat>=1.12.0
28
28
  Requires-Dist: apache-airflow-providers-common-sql>=1.32.0
29
+ Requires-Dist: psycopg[binary]>=3.2.9; python_version < '3.14'
30
+ Requires-Dist: psycopg[binary]>=3.3.3; python_version >= '3.14'
29
31
  Requires-Dist: psycopg2-binary>=2.9.9; python_version < '3.13'
30
32
  Requires-Dist: psycopg2-binary>=2.9.10; python_version >= '3.13'
31
33
  Requires-Dist: asyncpg>=0.30.0
32
34
  Requires-Dist: apache-airflow-providers-amazon>=2.6.0 ; extra == "amazon"
35
+ Requires-Dist: asyncpg>=0.30.0 ; extra == "asyncpg"
33
36
  Requires-Dist: apache-airflow-providers-microsoft-azure>=12.8.0 ; extra == "microsoft-azure"
34
37
  Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
35
38
  Requires-Dist: pandas>=2.1.2 ; extra == "pandas" and ( python_version <"3.13")
36
39
  Requires-Dist: pandas>=2.2.3 ; extra == "pandas" and ( python_version >="3.13" and python_version <"3.14")
37
40
  Requires-Dist: pandas>=2.3.3 ; extra == "pandas" and ( python_version >="3.14")
38
41
  Requires-Dist: polars>=1.26.0 ; extra == "polars"
39
- Requires-Dist: psycopg[binary]>=3.2.9 ; extra == "psycopg" and ( python_version < '3.14')
40
- Requires-Dist: psycopg[binary]>=3.3.3 ; extra == "psycopg" and ( python_version >= '3.14')
42
+ Requires-Dist: psycopg2-binary>=2.9.9 ; extra == "psycopg2" and ( python_version < '3.13')
43
+ Requires-Dist: psycopg2-binary>=2.9.10 ; extra == "psycopg2" and ( python_version >= '3.13')
41
44
  Requires-Dist: sqlalchemy>=1.4.54 ; extra == "sqlalchemy"
42
45
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
43
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/changelog.html
44
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0
46
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/changelog.html
47
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0
45
48
  Project-URL: Mastodon, https://fosstodon.org/@airflow
46
49
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
47
50
  Project-URL: Source Code, https://github.com/apache/airflow
48
51
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
49
52
  Provides-Extra: amazon
53
+ Provides-Extra: asyncpg
50
54
  Provides-Extra: microsoft-azure
51
55
  Provides-Extra: openlineage
52
56
  Provides-Extra: pandas
53
57
  Provides-Extra: polars
54
- Provides-Extra: psycopg
58
+ Provides-Extra: psycopg2
55
59
  Provides-Extra: sqlalchemy
56
60
 
57
61
 
@@ -79,7 +83,7 @@ Provides-Extra: sqlalchemy
79
83
 
80
84
  Package ``apache-airflow-providers-postgres``
81
85
 
82
- Release: ``6.8.0``
86
+ Release: ``7.0.0``
83
87
 
84
88
 
85
89
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -92,7 +96,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
92
96
  are in ``airflow.providers.postgres`` python package.
93
97
 
94
98
  You can find package information and changelog for the provider
95
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/>`_.
99
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/>`_.
96
100
 
97
101
  Installation
98
102
  ------------
@@ -112,13 +116,15 @@ PIP package Version required
112
116
  ``apache-airflow`` ``>=2.11.0``
113
117
  ``apache-airflow-providers-common-compat`` ``>=1.12.0``
114
118
  ``apache-airflow-providers-common-sql`` ``>=1.32.0``
119
+ ``psycopg[binary]`` ``>=3.2.9; python_version < "3.14"``
120
+ ``psycopg[binary]`` ``>=3.3.3; python_version >= "3.14"``
115
121
  ``psycopg2-binary`` ``>=2.9.9; python_version < "3.13"``
116
122
  ``psycopg2-binary`` ``>=2.9.10; python_version >= "3.13"``
117
123
  ``asyncpg`` ``>=0.30.0``
118
124
  ========================================== ======================================
119
125
 
120
- Cross provider package dependencies
121
- -----------------------------------
126
+ Optional cross provider package dependencies
127
+ --------------------------------------------
122
128
 
123
129
  Those are dependencies that might be needed in order to use all the features of the package.
124
130
  You need to install the specified providers in order to use them.
@@ -134,8 +140,6 @@ You can install such cross-provider dependencies when installing from PyPI. For
134
140
  Dependent package Extra
135
141
  ====================================================================================================================== ===================
136
142
  `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
137
- `apache-airflow-providers-common-compat <https://airflow.apache.org/docs/apache-airflow-providers-common-compat>`_ ``common.compat``
138
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
139
143
  `apache-airflow-providers-microsoft-azure <https://airflow.apache.org/docs/apache-airflow-providers-microsoft-azure>`_ ``microsoft.azure``
140
144
  `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
141
145
  ====================================================================================================================== ===================
@@ -147,14 +151,15 @@ Optional dependencies
147
151
  Extra Dependencies
148
152
  =================== ============================================================================================================================================================
149
153
  ``amazon`` ``apache-airflow-providers-amazon>=2.6.0``
154
+ ``asyncpg`` ``asyncpg>=0.30.0``
150
155
  ``microsoft.azure`` ``apache-airflow-providers-microsoft-azure>=12.8.0``
151
156
  ``openlineage`` ``apache-airflow-providers-openlineage``
152
157
  ``pandas`` ``pandas>=2.1.2; python_version <"3.13"``, ``pandas>=2.2.3; python_version >="3.13" and python_version <"3.14"``, ``pandas>=2.3.3; python_version >="3.14"``
153
158
  ``polars`` ``polars>=1.26.0``
154
- ``psycopg`` ``psycopg[binary]>=3.2.9; python_version < '3.14'``, ``psycopg[binary]>=3.3.3; python_version >= '3.14'``
159
+ ``psycopg2`` ``psycopg2-binary>=2.9.9; python_version < '3.13'``, ``psycopg2-binary>=2.9.10; python_version >= '3.13'``
155
160
  ``sqlalchemy`` ``sqlalchemy>=1.4.54``
156
161
  =================== ============================================================================================================================================================
157
162
 
158
163
  The changelog for the provider package can be found in the
159
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/changelog.html>`_.
164
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/changelog.html>`_.
160
165
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  Package ``apache-airflow-providers-postgres``
25
25
 
26
- Release: ``6.8.0``
26
+ Release: ``7.0.0``
27
27
 
28
28
 
29
29
  `PostgreSQL <https://www.postgresql.org/>`__
@@ -36,7 +36,7 @@ This is a provider package for ``postgres`` provider. All classes for this provi
36
36
  are in ``airflow.providers.postgres`` python package.
37
37
 
38
38
  You can find package information and changelog for the provider
39
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/>`_.
39
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/>`_.
40
40
 
41
41
  Installation
42
42
  ------------
@@ -56,13 +56,15 @@ PIP package Version required
56
56
  ``apache-airflow`` ``>=2.11.0``
57
57
  ``apache-airflow-providers-common-compat`` ``>=1.12.0``
58
58
  ``apache-airflow-providers-common-sql`` ``>=1.32.0``
59
+ ``psycopg[binary]`` ``>=3.2.9; python_version < "3.14"``
60
+ ``psycopg[binary]`` ``>=3.3.3; python_version >= "3.14"``
59
61
  ``psycopg2-binary`` ``>=2.9.9; python_version < "3.13"``
60
62
  ``psycopg2-binary`` ``>=2.9.10; python_version >= "3.13"``
61
63
  ``asyncpg`` ``>=0.30.0``
62
64
  ========================================== ======================================
63
65
 
64
- Cross provider package dependencies
65
- -----------------------------------
66
+ Optional cross provider package dependencies
67
+ --------------------------------------------
66
68
 
67
69
  Those are dependencies that might be needed in order to use all the features of the package.
68
70
  You need to install the specified providers in order to use them.
@@ -78,8 +80,6 @@ You can install such cross-provider dependencies when installing from PyPI. For
78
80
  Dependent package Extra
79
81
  ====================================================================================================================== ===================
80
82
  `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
81
- `apache-airflow-providers-common-compat <https://airflow.apache.org/docs/apache-airflow-providers-common-compat>`_ ``common.compat``
82
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
83
83
  `apache-airflow-providers-microsoft-azure <https://airflow.apache.org/docs/apache-airflow-providers-microsoft-azure>`_ ``microsoft.azure``
84
84
  `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
85
85
  ====================================================================================================================== ===================
@@ -91,13 +91,14 @@ Optional dependencies
91
91
  Extra Dependencies
92
92
  =================== ============================================================================================================================================================
93
93
  ``amazon`` ``apache-airflow-providers-amazon>=2.6.0``
94
+ ``asyncpg`` ``asyncpg>=0.30.0``
94
95
  ``microsoft.azure`` ``apache-airflow-providers-microsoft-azure>=12.8.0``
95
96
  ``openlineage`` ``apache-airflow-providers-openlineage``
96
97
  ``pandas`` ``pandas>=2.1.2; python_version <"3.13"``, ``pandas>=2.2.3; python_version >="3.13" and python_version <"3.14"``, ``pandas>=2.3.3; python_version >="3.14"``
97
98
  ``polars`` ``polars>=1.26.0``
98
- ``psycopg`` ``psycopg[binary]>=3.2.9; python_version < '3.14'``, ``psycopg[binary]>=3.3.3; python_version >= '3.14'``
99
+ ``psycopg2`` ``psycopg2-binary>=2.9.9; python_version < '3.13'``, ``psycopg2-binary>=2.9.10; python_version >= '3.13'``
99
100
  ``sqlalchemy`` ``sqlalchemy>=1.4.54``
100
101
  =================== ============================================================================================================================================================
101
102
 
102
103
  The changelog for the provider package can be found in the
103
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/changelog.html>`_.
104
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/changelog.html>`_.
@@ -27,6 +27,56 @@
27
27
  Changelog
28
28
  ---------
29
29
 
30
+ 7.0.0
31
+ .....
32
+
33
+ Breaking changes
34
+ ~~~~~~~~~~~~~~~~
35
+
36
+ .. note::
37
+ On Airflow 3.4.0 and later, the default async metadata-database driver becomes
38
+ ``psycopg`` (psycopg3): the derived async connection URL changes from
39
+ ``postgresql+asyncpg://`` to ``postgresql+psycopg_async://``, which is safe behind
40
+ transaction-mode PgBouncer with no extra configuration. ``psycopg[binary]`` is now
41
+ installed by default to serve it.
42
+
43
+ ``asyncpg`` remains installed by default as well. This provider still supports Airflow
44
+ cores older than 3.4.0, which derive the async URL as ``postgresql+asyncpg://``
45
+ unconditionally and have no psycopg fallback — so asyncpg must stay present for them to
46
+ work. It will become opt-in-only (via the existing ``[asyncpg]`` extra) in a future
47
+ release once the minimum supported Airflow is 3.4.0.
48
+
49
+ To keep using asyncpg on Airflow 3.4.0+, set
50
+ ``[database] sql_alchemy_conn_async = postgresql+asyncpg://...`` explicitly.
51
+
52
+ .. note::
53
+ On Airflow 3.4.0 and later, ``psycopg`` (psycopg3) becomes the default synchronous Postgres
54
+ driver, mirroring the async default above. ``psycopg[binary]`` is installed by default to serve it.
55
+
56
+ ``psycopg2-binary`` remains installed by default as well. This provider still supports Airflow
57
+ cores older than 3.4.0, which normalize the synchronous metadata-database connection to
58
+ ``postgresql+psycopg2://`` and have no psycopg fallback; Airflow 2.11 additionally ships
59
+ SQLAlchemy 1.4, which has no native ``psycopg`` (v3) dialect at all — so psycopg2 must stay
60
+ present for those cores to work. It will become opt-in-only (via the existing ``[psycopg2]``
61
+ extra) in a future release once the minimum supported Airflow is 3.4.0.
62
+
63
+ To keep using psycopg2 on Airflow 3.4.0+, set
64
+ ``[database] sql_alchemy_conn = postgresql+psycopg2://...`` explicitly.
65
+
66
+ * ``Make psycopg (v3) the default synchronous Postgres driver (#69526)``
67
+ * ``Switch the default async Postgres driver from asyncpg to psycopg3 (#69089)``
68
+
69
+ Misc
70
+ ~~~~
71
+
72
+ * ``Keep asyncpg installed by default in the Postgres provider (#69690)``
73
+
74
+ .. Below changes are excluded from the changelog. Move them to
75
+ appropriate section above if needed. Do not delete the lines(!):
76
+ * ``Prepare providers release 2026-07-06 (#69486)``
77
+ * ``Document each provider's optional extras in its docs index (#69478)``
78
+ * ``Fix inconsistency between generated provider docs and pyproject.toml (#68991)``
79
+
30
80
  6.8.0
31
81
  .....
32
82
 
@@ -78,7 +78,7 @@ apache-airflow-providers-postgres package
78
78
  `PostgreSQL <https://www.postgresql.org/>`__
79
79
 
80
80
 
81
- Release: 6.8.0
81
+ Release: 7.0.0
82
82
 
83
83
  Provider package
84
84
  ----------------
@@ -104,13 +104,15 @@ PIP package Version required
104
104
  ``apache-airflow`` ``>=2.11.0``
105
105
  ``apache-airflow-providers-common-compat`` ``>=1.12.0``
106
106
  ``apache-airflow-providers-common-sql`` ``>=1.32.0``
107
+ ``psycopg[binary]`` ``>=3.2.9; python_version < "3.14"``
108
+ ``psycopg[binary]`` ``>=3.3.3; python_version >= "3.14"``
107
109
  ``psycopg2-binary`` ``>=2.9.9; python_version < "3.13"``
108
110
  ``psycopg2-binary`` ``>=2.9.10; python_version >= "3.13"``
109
111
  ``asyncpg`` ``>=0.30.0``
110
112
  ========================================== ======================================
111
113
 
112
- Cross provider package dependencies
113
- -----------------------------------
114
+ Optional cross provider package dependencies
115
+ --------------------------------------------
114
116
 
115
117
  Those are dependencies that might be needed in order to use all the features of the package.
116
118
  You need to install the specified provider distributions in order to use them.
@@ -126,17 +128,39 @@ You can install such cross-provider dependencies when installing from PyPI. For
126
128
  Dependent package Extra
127
129
  ====================================================================================================================== ===================
128
130
  `apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
129
- `apache-airflow-providers-common-compat <https://airflow.apache.org/docs/apache-airflow-providers-common-compat>`_ ``common.compat``
130
- `apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
131
131
  `apache-airflow-providers-microsoft-azure <https://airflow.apache.org/docs/apache-airflow-providers-microsoft-azure>`_ ``microsoft.azure``
132
132
  `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
133
133
  ====================================================================================================================== ===================
134
134
 
135
+ Optional dependencies
136
+ ---------------------
137
+
138
+ These extras install optional third-party libraries that enable additional features of the provider.
139
+ Install them when installing from PyPI. For example:
140
+
141
+ .. code-block:: bash
142
+
143
+ pip install apache-airflow-providers-postgres[amazon]
144
+
145
+
146
+ =================== ============================================================================================================================================================
147
+ Extra Dependencies
148
+ =================== ============================================================================================================================================================
149
+ ``amazon`` ``apache-airflow-providers-amazon>=2.6.0``
150
+ ``asyncpg`` ``asyncpg>=0.30.0``
151
+ ``microsoft.azure`` ``apache-airflow-providers-microsoft-azure>=12.8.0``
152
+ ``openlineage`` ``apache-airflow-providers-openlineage``
153
+ ``pandas`` ``pandas>=2.1.2; python_version <"3.13"``, ``pandas>=2.2.3; python_version >="3.13" and python_version <"3.14"``, ``pandas>=2.3.3; python_version >="3.14"``
154
+ ``polars`` ``polars>=1.26.0``
155
+ ``psycopg2`` ``psycopg2-binary>=2.9.9; python_version < '3.13'``, ``psycopg2-binary>=2.9.10; python_version >= '3.13'``
156
+ ``sqlalchemy`` ``sqlalchemy>=1.4.54``
157
+ =================== ============================================================================================================================================================
158
+
135
159
  Downloading official packages
136
160
  -----------------------------
137
161
 
138
162
  You can download officially released packages and verify their checksums and signatures from the
139
163
  `Official Apache Download site <https://downloads.apache.org/airflow/providers/>`_
140
164
 
141
- * `The apache-airflow-providers-postgres 6.8.0 sdist package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0.tar.gz>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0.tar.gz.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0.tar.gz.sha512>`__)
142
- * `The apache-airflow-providers-postgres 6.8.0 wheel package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0-py3-none-any.whl>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0-py3-none-any.whl.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.8.0-py3-none-any.whl.sha512>`__)
165
+ * `The apache-airflow-providers-postgres 7.0.0 sdist package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0.tar.gz>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0.tar.gz.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0.tar.gz.sha512>`__)
166
+ * `The apache-airflow-providers-postgres 7.0.0 wheel package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0-py3-none-any.whl>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0-py3-none-any.whl.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-7.0.0-py3-none-any.whl.sha512>`__)
@@ -55,7 +55,7 @@ Dumping SQL statements into your operator isn't quite appealing and will create
55
55
  down to the road. To prevent this, Airflow offers an elegant solution. This is how it works: you simply create
56
56
  a directory inside the Dag folder called ``sql`` and then put all the SQL files containing your SQL queries inside it.
57
57
 
58
- Your ``dags/sql/pet_schema.sql`` should like this:
58
+ Your ``dags/sql/pet_schema.sql`` should look like this:
59
59
 
60
60
  ::
61
61
 
@@ -23,12 +23,13 @@ description: |
23
23
 
24
24
  state: ready
25
25
  lifecycle: production
26
- source-date-epoch: 1781642052
26
+ source-date-epoch: 1784746595
27
27
  # Note that those versions are maintained by release manager - do not update them manually
28
28
  # with the exception of case where other provider in sources has >= new provider version.
29
29
  # In such case adding >= NEW_VERSION and bumping to NEW_VERSION in a provider have
30
30
  # to be done in the same PR
31
31
  versions:
32
+ - 7.0.0
32
33
  - 6.8.0
33
34
  - 6.7.1
34
35
  - 6.7.0
@@ -25,7 +25,7 @@ build-backend = "flit_core.buildapi"
25
25
 
26
26
  [project]
27
27
  name = "apache-airflow-providers-postgres"
28
- version = "6.8.0"
28
+ version = "7.0.0"
29
29
  description = "Provider package apache-airflow-providers-postgres for Apache Airflow"
30
30
  readme = "README.rst"
31
31
  license = "Apache-2.0"
@@ -62,6 +62,16 @@ dependencies = [
62
62
  "apache-airflow>=2.11.0",
63
63
  "apache-airflow-providers-common-compat>=1.12.0",
64
64
  "apache-airflow-providers-common-sql>=1.32.0",
65
+ "psycopg[binary]>=3.2.9; python_version < '3.14'",
66
+ "psycopg[binary]>=3.3.3; python_version >= '3.14'",
67
+ # psycopg2-binary and asyncpg must stay default dependencies while this provider still
68
+ # supports Airflow cores older than 3.4.0. Those cores normalize the sync metadata-DB conn
69
+ # to ``postgresql+psycopg2://`` (see core ``_upgrade_postgres_metastore_conn``) and derive
70
+ # the async URL as ``postgresql+asyncpg://`` unconditionally, with no psycopg fallback;
71
+ # Airflow 2.11 additionally ships SQLAlchemy 1.4, which has no native ``psycopg`` (v3)
72
+ # dialect at all. The psycopg3 defaults only take effect on 3.4.0+, so both drivers become
73
+ # opt-in-only (via the ``[psycopg2]`` / ``[asyncpg]`` extras) together once the minimum
74
+ # supported Airflow is >= 3.4.0; tracked at https://github.com/apache/airflow/issues/68453
65
75
  "psycopg2-binary>=2.9.9; python_version < '3.13'",
66
76
  "psycopg2-binary>=2.9.10; python_version >= '3.13'",
67
77
  "asyncpg>=0.30.0",
@@ -73,6 +83,9 @@ dependencies = [
73
83
  "amazon" = [
74
84
  "apache-airflow-providers-amazon>=2.6.0",
75
85
  ]
86
+ "asyncpg" = [
87
+ "asyncpg>=0.30.0",
88
+ ]
76
89
  "microsoft.azure" = [
77
90
  "apache-airflow-providers-microsoft-azure>=12.8.0"
78
91
  ]
@@ -87,9 +100,9 @@ dependencies = [
87
100
  "polars" = [
88
101
  "polars>=1.26.0"
89
102
  ]
90
- "psycopg" = [
91
- "psycopg[binary]>=3.2.9; python_version < '3.14'",
92
- "psycopg[binary]>=3.3.3; python_version >= '3.14'",
103
+ "psycopg2" = [
104
+ "psycopg2-binary>=2.9.9; python_version < '3.13'",
105
+ "psycopg2-binary>=2.9.10; python_version >= '3.13'",
93
106
  ]
94
107
  "sqlalchemy" = [
95
108
  "sqlalchemy>=1.4.54"
@@ -108,6 +121,7 @@ dev = [
108
121
  # Additional devel dependencies (do not remove this line and add extra development dependencies)
109
122
  "apache-airflow-providers-common-sql[pandas]",
110
123
  "apache-airflow-providers-common-sql[polars]",
124
+ "apache-airflow-providers-postgres[asyncpg]",
111
125
  "apache-airflow-providers-postgres[sqlalchemy]"
112
126
  ]
113
127
 
@@ -137,8 +151,8 @@ apache-airflow-providers-common-sql = {workspace = true}
137
151
  apache-airflow-providers-standard = {workspace = true}
138
152
 
139
153
  [project.urls]
140
- "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0"
141
- "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.8.0/changelog.html"
154
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0"
155
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/7.0.0/changelog.html"
142
156
  "Bug Tracker" = "https://github.com/apache/airflow/issues"
143
157
  "Source Code" = "https://github.com/apache/airflow"
144
158
  "Slack Chat" = "https://s.apache.org/airflow-slack"
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "6.8.0"
32
+ __version__ = "7.0.0"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.11.0"
@@ -18,14 +18,12 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  import os
21
- from collections.abc import Iterable, Mapping
21
+ from collections.abc import Callable, Iterable, Mapping
22
22
  from contextlib import closing
23
23
  from copy import deepcopy
24
- from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias, cast, overload
24
+ from typing import TYPE_CHECKING, Any, Literal, NoReturn, Protocol, TypeAlias, cast, overload
25
25
 
26
26
  from more_itertools import chunked
27
- from psycopg2 import connect as ppg2_connect
28
- from psycopg2.extras import DictCursor, NamedTupleCursor, RealDictCursor, execute_values
29
27
 
30
28
  from airflow.providers.common.compat.sdk import (
31
29
  AirflowException,
@@ -54,9 +52,35 @@ if USE_PSYCOPG3:
54
52
  from psycopg.rows import dict_row, namedtuple_row
55
53
  from psycopg.types.json import register_default_adapters
56
54
 
55
+ try:
56
+ import psycopg2 as _psycopg2
57
+ import psycopg2.extras as _psycopg2_extras
58
+ except (ImportError, ModuleNotFoundError):
59
+ _psycopg2 = None
60
+ _psycopg2_extras = None
61
+
62
+ ppg2_connect: Callable[..., Any] | None = _psycopg2.connect if _psycopg2 else None
63
+ DictCursor: type | None = _psycopg2_extras.DictCursor if _psycopg2_extras else None
64
+ NamedTupleCursor: type | None = _psycopg2_extras.NamedTupleCursor if _psycopg2_extras else None
65
+ RealDictCursor: type | None = _psycopg2_extras.RealDictCursor if _psycopg2_extras else None
66
+ execute_values: Callable[..., Any] | None = _psycopg2_extras.execute_values if _psycopg2_extras else None
67
+
68
+
69
+ def _require_psycopg2() -> NoReturn:
70
+ raise AirflowOptionalProviderFeatureException(
71
+ "psycopg2 is not installed. Please install it with "
72
+ "`pip install apache-airflow-providers-postgres[psycopg2]`."
73
+ )
74
+
75
+
57
76
  if TYPE_CHECKING:
58
77
  from pandas import DataFrame as PandasDataFrame
59
78
  from polars import DataFrame as PolarsDataFrame
79
+ from psycopg2.extras import (
80
+ DictCursor as _DictCursorType,
81
+ NamedTupleCursor as _NamedTupleCursorType,
82
+ RealDictCursor as _RealDictCursorType,
83
+ )
60
84
  from sqlalchemy.engine import URL
61
85
 
62
86
  from airflow.providers.common.sql.dialects.dialect import Dialect
@@ -65,35 +89,19 @@ if TYPE_CHECKING:
65
89
  if USE_PSYCOPG3:
66
90
  from psycopg.errors import Diagnostic
67
91
 
68
- CursorType: TypeAlias = DictCursor | RealDictCursor | NamedTupleCursor
92
+ CursorType: TypeAlias = _DictCursorType | _RealDictCursorType | _NamedTupleCursorType
69
93
  CursorRow: TypeAlias = dict[str, Any] | tuple[Any, ...]
70
94
 
71
95
 
72
96
  class CompatConnection(Protocol):
73
- """Protocol for type hinting psycopg2 and psycopg3 connection objects."""
97
+ """Protocol for the common interface shared by psycopg2 and psycopg3 connection objects."""
74
98
 
75
99
  def cursor(self, *args, **kwargs) -> Any: ...
76
100
  def commit(self) -> None: ...
77
101
  def close(self) -> None: ...
78
-
79
- # Context manager support
80
- def __enter__(self) -> CompatConnection: ...
102
+ def __enter__(self) -> Any: ...
81
103
  def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
82
104
 
83
- # Common properties
84
- @property
85
- def notices(self) -> list[Any]: ...
86
-
87
- # psycopg3 specific (optional)
88
- @property
89
- def adapters(self) -> Any: ...
90
-
91
- @property
92
- def row_factory(self) -> Any: ...
93
-
94
- # Optional method for psycopg3
95
- def add_notice_handler(self, handler: Any) -> None: ...
96
-
97
105
 
98
106
  class PostgresHook(DbApiHook):
99
107
  """
@@ -220,6 +228,9 @@ class PostgresHook(DbApiHook):
220
228
  valid_cursors = "dictcursor, namedtuplecursor"
221
229
  raise ValueError(f"Invalid cursor passed {_cursor}. Valid options are: {valid_cursors}")
222
230
 
231
+ if DictCursor is None:
232
+ _require_psycopg2()
233
+
223
234
  cursor_types = {
224
235
  "dictcursor": DictCursor,
225
236
  "realdictcursor": RealDictCursor,
@@ -251,6 +262,9 @@ class PostgresHook(DbApiHook):
251
262
 
252
263
  return connection
253
264
 
265
+ if ppg2_connect is None:
266
+ _require_psycopg2()
267
+
254
268
  return ppg2_connect(**conn_args)
255
269
 
256
270
  def _generate_cursor_name(self):
@@ -707,6 +721,8 @@ class PostgresHook(DbApiHook):
707
721
  )
708
722
 
709
723
  # if fast_executemany is enabled with psycopg2, use optimized execute_values from psycopg
724
+ if execute_values is None:
725
+ _require_psycopg2()
710
726
  self._insert_statement_format = "INSERT INTO {} {} VALUES %s"
711
727
 
712
728
  nb_rows = 0
@@ -58,6 +58,27 @@ else:
58
58
  import psycopg2.extras
59
59
 
60
60
 
61
+ def test_hooks_postgres_raises_clear_error_without_psycopg2(monkeypatch):
62
+ """PostgresHook must fail loudly (not with a bare ImportError or a real connection attempt)
63
+ when psycopg2-specific functionality is used but psycopg2 isn't installed."""
64
+ import airflow.providers.postgres.hooks.postgres as postgres_module
65
+
66
+ monkeypatch.setattr(postgres_module, "USE_PSYCOPG3", False)
67
+ monkeypatch.setattr(postgres_module, "ppg2_connect", None)
68
+ monkeypatch.setattr(postgres_module, "DictCursor", None)
69
+ monkeypatch.setattr(postgres_module, "RealDictCursor", None)
70
+ monkeypatch.setattr(postgres_module, "NamedTupleCursor", None)
71
+ monkeypatch.setattr(postgres_module, "execute_values", None)
72
+
73
+ hook = postgres_module.PostgresHook.__new__(postgres_module.PostgresHook)
74
+ with pytest.raises(AirflowOptionalProviderFeatureException, match="psycopg2 is not installed"):
75
+ hook._get_cursor("dictcursor")
76
+ with pytest.raises(AirflowOptionalProviderFeatureException, match="psycopg2 is not installed"):
77
+ hook._create_connection({})
78
+ with pytest.raises(AirflowOptionalProviderFeatureException, match="psycopg2 is not installed"):
79
+ hook.insert_rows(table="t", rows=[(1,)], fast_executemany=True)
80
+
81
+
61
82
  @pytest.fixture
62
83
  def mock_connect(mocker):
63
84
  """Mock the connection object according to the correct psycopg version."""
@@ -0,0 +1,46 @@
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
+ from __future__ import annotations
18
+
19
+ from importlib import metadata
20
+
21
+ import pytest
22
+
23
+ DISTRIBUTION = "apache-airflow-providers-postgres"
24
+
25
+
26
+ def _default_requirements() -> list[str]:
27
+ """Requirement strings the provider installs by default (i.e. not gated behind an extra)."""
28
+ return [req for req in (metadata.requires(DISTRIBUTION) or []) if "extra ==" not in req]
29
+
30
+
31
+ @pytest.mark.parametrize("package", ["psycopg2-binary", "asyncpg"])
32
+ def test_backcompat_driver_stays_a_default_dependency(package):
33
+ """
34
+ ``psycopg2-binary`` (sync) and ``asyncpg`` (async) must remain default dependencies, not
35
+ optional extras, while the provider supports Airflow cores older than 3.4.0. Those cores
36
+ normalize the sync metadata-DB conn to ``postgresql+psycopg2://`` and derive the async URL as
37
+ ``postgresql+asyncpg://`` with no psycopg fallback (and Airflow 2.11 ships SQLAlchemy 1.4,
38
+ which has no ``psycopg`` v3 dialect), so demoting either driver to an extra silently breaks
39
+ them. Removal is gated on bumping the floor to 3.4.0; see
40
+ https://github.com/apache/airflow/issues/68453
41
+ """
42
+ defaults = _default_requirements()
43
+ assert any(req.startswith(package) for req in defaults), (
44
+ f"{package} must stay a default dependency of {DISTRIBUTION} until the minimum supported "
45
+ f"Airflow is >= 3.4.0. Default dependencies were: {defaults}"
46
+ )