apache-airflow-providers-postgres 6.2.3__tar.gz → 6.3.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.
Potentially problematic release.
This version of apache-airflow-providers-postgres might be problematic. Click here for more details.
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/PKG-INFO +9 -8
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/README.rst +4 -5
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/changelog.rst +35 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/connections/postgres.rst +1 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/index.rst +5 -7
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/operators.rst +4 -4
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/provider.yaml +2 -1
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/pyproject.toml +8 -4
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/__init__.py +1 -1
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/dialects/postgres.py +64 -13
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/hooks/postgres.py +260 -37
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/dialects/test_postgres.py +9 -12
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/hooks/test_postgres.py +722 -253
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/.latest-doc-only-change.txt +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/commits.rst +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/conf.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/dialects.rst +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/installing-providers-from-sources.rst +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/integration-logos/Postgres.png +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/redirects.txt +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/security.rst +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/LICENSE +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/assets/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/assets/postgres.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/dialects/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/get_provider_info.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/src/airflow/providers/postgres/hooks/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/conftest.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/system/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/system/postgres/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/system/postgres/example_postgres.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/assets/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/assets/test_postgres.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/dialects/__init__.py +0 -0
- {apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/tests/unit/postgres/hooks/__init__.py +0 -0
{apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-airflow-providers-postgres
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.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>
|
|
@@ -30,9 +30,10 @@ Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
|
30
30
|
Requires-Dist: pandas>=2.1.2 ; extra == "pandas" and ( python_version <"3.13")
|
|
31
31
|
Requires-Dist: pandas>=2.2.3 ; extra == "pandas" and ( python_version >="3.13")
|
|
32
32
|
Requires-Dist: polars>=1.26.0 ; extra == "polars"
|
|
33
|
+
Requires-Dist: psycopg[binary]>=3.2.9 ; extra == "psycopg"
|
|
33
34
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
34
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
35
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
35
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/changelog.html
|
|
36
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0
|
|
36
37
|
Project-URL: Mastodon, https://fosstodon.org/@airflow
|
|
37
38
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
38
39
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
@@ -41,6 +42,7 @@ Provides-Extra: amazon
|
|
|
41
42
|
Provides-Extra: openlineage
|
|
42
43
|
Provides-Extra: pandas
|
|
43
44
|
Provides-Extra: polars
|
|
45
|
+
Provides-Extra: psycopg
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
.. Licensed to the Apache Software Foundation (ASF) under one
|
|
@@ -67,9 +69,8 @@ Provides-Extra: polars
|
|
|
67
69
|
|
|
68
70
|
Package ``apache-airflow-providers-postgres``
|
|
69
71
|
|
|
70
|
-
Release: ``6.
|
|
72
|
+
Release: ``6.3.0``
|
|
71
73
|
|
|
72
|
-
Release Date: ``|PypiReleaseDate|``
|
|
73
74
|
|
|
74
75
|
`PostgreSQL <https://www.postgresql.org/>`__
|
|
75
76
|
|
|
@@ -81,12 +82,12 @@ This is a provider package for ``postgres`` provider. All classes for this provi
|
|
|
81
82
|
are in ``airflow.providers.postgres`` python package.
|
|
82
83
|
|
|
83
84
|
You can find package information and changelog for the provider
|
|
84
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
85
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/>`_.
|
|
85
86
|
|
|
86
87
|
Installation
|
|
87
88
|
------------
|
|
88
89
|
|
|
89
|
-
You can install this package on top of an existing Airflow
|
|
90
|
+
You can install this package on top of an existing Airflow installation (see ``Requirements`` below
|
|
90
91
|
for the minimum Airflow version supported) via
|
|
91
92
|
``pip install apache-airflow-providers-postgres``
|
|
92
93
|
|
|
@@ -127,5 +128,5 @@ Dependent package
|
|
|
127
128
|
============================================================================================================== ===============
|
|
128
129
|
|
|
129
130
|
The changelog for the provider package can be found in the
|
|
130
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
131
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/changelog.html>`_.
|
|
131
132
|
|
{apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/README.rst
RENAMED
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
Package ``apache-airflow-providers-postgres``
|
|
25
25
|
|
|
26
|
-
Release: ``6.
|
|
26
|
+
Release: ``6.3.0``
|
|
27
27
|
|
|
28
|
-
Release Date: ``|PypiReleaseDate|``
|
|
29
28
|
|
|
30
29
|
`PostgreSQL <https://www.postgresql.org/>`__
|
|
31
30
|
|
|
@@ -37,12 +36,12 @@ This is a provider package for ``postgres`` provider. All classes for this provi
|
|
|
37
36
|
are in ``airflow.providers.postgres`` python package.
|
|
38
37
|
|
|
39
38
|
You can find package information and changelog for the provider
|
|
40
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
39
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/>`_.
|
|
41
40
|
|
|
42
41
|
Installation
|
|
43
42
|
------------
|
|
44
43
|
|
|
45
|
-
You can install this package on top of an existing Airflow
|
|
44
|
+
You can install this package on top of an existing Airflow installation (see ``Requirements`` below
|
|
46
45
|
for the minimum Airflow version supported) via
|
|
47
46
|
``pip install apache-airflow-providers-postgres``
|
|
48
47
|
|
|
@@ -83,4 +82,4 @@ Dependent package
|
|
|
83
82
|
============================================================================================================== ===============
|
|
84
83
|
|
|
85
84
|
The changelog for the provider package can be found in the
|
|
86
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
85
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/changelog.html>`_.
|
|
@@ -27,6 +27,41 @@
|
|
|
27
27
|
Changelog
|
|
28
28
|
---------
|
|
29
29
|
|
|
30
|
+
6.3.0
|
|
31
|
+
.....
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Release Date: ``|PypiReleaseDate|``
|
|
35
|
+
|
|
36
|
+
Features
|
|
37
|
+
~~~~~~~~
|
|
38
|
+
|
|
39
|
+
* ``Added specialized insert_rows in PostgresHook which uses faster psycopg execute_batch method (#54988)``
|
|
40
|
+
* ``Add rudimentary support for psycopg3 (#52976)``
|
|
41
|
+
* ``Implemented native get_column_names in PostgresDialect to become SQLAlchemy independent (#54437)``
|
|
42
|
+
|
|
43
|
+
Bug Fixes
|
|
44
|
+
~~~~~~~~~
|
|
45
|
+
|
|
46
|
+
* ``PostgresDialect should use index instead of name in get_column_names and get_primary_keys (#54832)``
|
|
47
|
+
|
|
48
|
+
Misc
|
|
49
|
+
~~~~
|
|
50
|
+
|
|
51
|
+
* ``Add CI support for SQLAlchemy 2.0 (#52233)``
|
|
52
|
+
|
|
53
|
+
Doc-only
|
|
54
|
+
~~~~~~~~
|
|
55
|
+
|
|
56
|
+
* ``Make term Dag consistent in providers docs (#55101)``
|
|
57
|
+
|
|
58
|
+
.. Below changes are excluded from the changelog. Move them to
|
|
59
|
+
appropriate section above if needed. Do not delete the lines(!):
|
|
60
|
+
* ``Switch pre-commit to prek (#54258)``
|
|
61
|
+
|
|
62
|
+
.. Review and move the new changes to one of the sections above:
|
|
63
|
+
* ``Fix Airflow 2 reference in README/index of providers (#55240)``
|
|
64
|
+
|
|
30
65
|
6.2.3
|
|
31
66
|
.....
|
|
32
67
|
|
|
@@ -75,6 +75,7 @@ Extra (optional)
|
|
|
75
75
|
- ``namedtuplecursor``: Returns query results as named tuples using ``psycopg2.extras.NamedTupleCursor``.
|
|
76
76
|
|
|
77
77
|
For more information, refer to the psycopg2 documentation on `connection and cursor subclasses <https://www.psycopg.org/docs/extras.html#connection-and-cursor-subclasses>`_.
|
|
78
|
+
If using psycopg (v3), refer to the documentation on `connection classes <https://www.psycopg.org/psycopg3/docs/api/connections.html>`_.
|
|
78
79
|
|
|
79
80
|
More details on all Postgres parameters supported can be found in
|
|
80
81
|
`Postgres documentation <https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING>`_.
|
{apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/docs/index.rst
RENAMED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
:maxdepth: 1
|
|
57
57
|
:caption: Resources
|
|
58
58
|
|
|
59
|
-
Example
|
|
59
|
+
Example Dags <https://github.com/apache/airflow/tree/providers-postgres/|version|/providers/postgres/tests/system/postgres>
|
|
60
60
|
PyPI Repository <https://pypi.org/project/apache-airflow-providers-postgres/>
|
|
61
61
|
Installing from sources <installing-providers-from-sources>
|
|
62
62
|
|
|
@@ -77,9 +77,7 @@ apache-airflow-providers-postgres package
|
|
|
77
77
|
`PostgreSQL <https://www.postgresql.org/>`__
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
Release: 6.
|
|
81
|
-
|
|
82
|
-
Release Date: ``|PypiReleaseDate|``
|
|
80
|
+
Release: 6.3.0
|
|
83
81
|
|
|
84
82
|
Provider package
|
|
85
83
|
----------------
|
|
@@ -90,7 +88,7 @@ All classes for this package are included in the ``airflow.providers.postgres``
|
|
|
90
88
|
Installation
|
|
91
89
|
------------
|
|
92
90
|
|
|
93
|
-
You can install this package on top of an existing Airflow
|
|
91
|
+
You can install this package on top of an existing Airflow installation via
|
|
94
92
|
``pip install apache-airflow-providers-postgres``.
|
|
95
93
|
For the minimum Airflow version supported, see ``Requirements`` below.
|
|
96
94
|
|
|
@@ -136,5 +134,5 @@ Downloading official packages
|
|
|
136
134
|
You can download officially released packages and verify their checksums and signatures from the
|
|
137
135
|
`Official Apache Download site <https://downloads.apache.org/airflow/providers/>`_
|
|
138
136
|
|
|
139
|
-
* `The apache-airflow-providers-postgres 6.
|
|
140
|
-
* `The apache-airflow-providers-postgres 6.
|
|
137
|
+
* `The apache-airflow-providers-postgres 6.3.0 sdist package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0.tar.gz>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0.tar.gz.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0.tar.gz.sha512>`__)
|
|
138
|
+
* `The apache-airflow-providers-postgres 6.3.0 wheel package <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0-py3-none-any.whl>`_ (`asc <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0-py3-none-any.whl.asc>`__, `sha512 <https://downloads.apache.org/airflow/providers/apache_airflow_providers_postgres-6.3.0-py3-none-any.whl.sha512>`__)
|
|
@@ -53,7 +53,7 @@ The code snippets below are based on Airflow-2.0
|
|
|
53
53
|
|
|
54
54
|
Dumping SQL statements into your operator isn't quite appealing and will create maintainability pains somewhere
|
|
55
55
|
down to the road. To prevent this, Airflow offers an elegant solution. This is how it works: you simply create
|
|
56
|
-
a directory inside the
|
|
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
58
|
Your ``dags/sql/pet_schema.sql`` should like this:
|
|
59
59
|
|
|
@@ -68,7 +68,7 @@ Your ``dags/sql/pet_schema.sql`` should like this:
|
|
|
68
68
|
OWNER VARCHAR NOT NULL);
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
Now let's refactor ``create_pet_table`` in our
|
|
71
|
+
Now let's refactor ``create_pet_table`` in our Dag:
|
|
72
72
|
|
|
73
73
|
.. code-block:: python
|
|
74
74
|
|
|
@@ -187,10 +187,10 @@ sent to the server at connection start.
|
|
|
187
187
|
:end-before: [END postgres_sql_execute_query_operator_howto_guide_get_birth_date]
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
The complete Postgres Operator
|
|
190
|
+
The complete Postgres Operator Dag
|
|
191
191
|
----------------------------------
|
|
192
192
|
|
|
193
|
-
When we put everything together, our
|
|
193
|
+
When we put everything together, our Dag should look like this:
|
|
194
194
|
|
|
195
195
|
.. exampleinclude:: /../../postgres/tests/system/postgres/example_postgres.py
|
|
196
196
|
:language: python
|
{apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/provider.yaml
RENAMED
|
@@ -22,12 +22,13 @@ description: |
|
|
|
22
22
|
`PostgreSQL <https://www.postgresql.org/>`__
|
|
23
23
|
|
|
24
24
|
state: ready
|
|
25
|
-
source-date-epoch:
|
|
25
|
+
source-date-epoch: 1756877337
|
|
26
26
|
# Note that those versions are maintained by release manager - do not update them manually
|
|
27
27
|
# with the exception of case where other provider in sources has >= new provider version.
|
|
28
28
|
# In such case adding >= NEW_VERSION and bumping to NEW_VERSION in a provider have
|
|
29
29
|
# to be done in the same PR
|
|
30
30
|
versions:
|
|
31
|
+
- 6.3.0
|
|
31
32
|
- 6.2.3
|
|
32
33
|
- 6.2.2
|
|
33
34
|
- 6.2.1
|
{apache_airflow_providers_postgres-6.2.3 → apache_airflow_providers_postgres-6.3.0}/pyproject.toml
RENAMED
|
@@ -25,7 +25,7 @@ build-backend = "flit_core.buildapi"
|
|
|
25
25
|
|
|
26
26
|
[project]
|
|
27
27
|
name = "apache-airflow-providers-postgres"
|
|
28
|
-
version = "6.
|
|
28
|
+
version = "6.3.0"
|
|
29
29
|
description = "Provider package apache-airflow-providers-postgres for Apache Airflow"
|
|
30
30
|
readme = "README.rst"
|
|
31
31
|
authors = [
|
|
@@ -54,7 +54,7 @@ requires-python = ">=3.10"
|
|
|
54
54
|
|
|
55
55
|
# The dependencies should be modified in place in the generated file.
|
|
56
56
|
# Any change in the dependencies is preserved when the file is regenerated
|
|
57
|
-
# Make sure to run ``
|
|
57
|
+
# Make sure to run ``prek update-providers-dependencies --all-files``
|
|
58
58
|
# After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build``
|
|
59
59
|
dependencies = [
|
|
60
60
|
"apache-airflow>=2.10.0",
|
|
@@ -80,6 +80,9 @@ dependencies = [
|
|
|
80
80
|
"polars" = [
|
|
81
81
|
"polars>=1.26.0"
|
|
82
82
|
]
|
|
83
|
+
"psycopg" = [
|
|
84
|
+
"psycopg[binary]>=3.2.9",
|
|
85
|
+
]
|
|
83
86
|
|
|
84
87
|
[dependency-groups]
|
|
85
88
|
dev = [
|
|
@@ -92,6 +95,7 @@ dev = [
|
|
|
92
95
|
# Additional devel dependencies (do not remove this line and add extra development dependencies)
|
|
93
96
|
"apache-airflow-providers-common-sql[pandas]",
|
|
94
97
|
"apache-airflow-providers-common-sql[polars]",
|
|
98
|
+
"psycopg[binary]>=3.2.9",
|
|
95
99
|
]
|
|
96
100
|
|
|
97
101
|
# To build docs:
|
|
@@ -120,8 +124,8 @@ apache-airflow-providers-common-sql = {workspace = true}
|
|
|
120
124
|
apache-airflow-providers-standard = {workspace = true}
|
|
121
125
|
|
|
122
126
|
[project.urls]
|
|
123
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
124
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.
|
|
127
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0"
|
|
128
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-postgres/6.3.0/changelog.html"
|
|
125
129
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
|
126
130
|
"Source Code" = "https://github.com/apache/airflow"
|
|
127
131
|
"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.
|
|
32
|
+
__version__ = "6.3.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"2.10.0"
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
# under the License.
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
+
from collections.abc import Callable
|
|
20
|
+
|
|
19
21
|
from methodtools import lru_cache
|
|
20
22
|
|
|
21
|
-
from airflow.providers.common.sql.dialects.dialect import Dialect
|
|
23
|
+
from airflow.providers.common.sql.dialects.dialect import Dialect, T
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
class PostgresDialect(Dialect):
|
|
@@ -39,22 +41,71 @@ class PostgresDialect(Dialect):
|
|
|
39
41
|
"""
|
|
40
42
|
if schema is None:
|
|
41
43
|
table, schema = self.extract_schema_from_table(table)
|
|
42
|
-
sql = """
|
|
43
|
-
select kcu.column_name
|
|
44
|
-
from information_schema.table_constraints tco
|
|
45
|
-
join information_schema.key_column_usage kcu
|
|
46
|
-
on kcu.constraint_name = tco.constraint_name
|
|
47
|
-
and kcu.constraint_schema = tco.constraint_schema
|
|
48
|
-
and kcu.constraint_name = tco.constraint_name
|
|
49
|
-
where tco.constraint_type = 'PRIMARY KEY'
|
|
50
|
-
and kcu.table_schema = %s
|
|
51
|
-
and kcu.table_name = %s
|
|
52
|
-
"""
|
|
53
44
|
pk_columns = [
|
|
54
|
-
row[0]
|
|
45
|
+
row[0]
|
|
46
|
+
for row in self.get_records(
|
|
47
|
+
"""
|
|
48
|
+
select kcu.column_name
|
|
49
|
+
from information_schema.table_constraints tco
|
|
50
|
+
join information_schema.key_column_usage kcu
|
|
51
|
+
on kcu.constraint_name = tco.constraint_name
|
|
52
|
+
and kcu.constraint_schema = tco.constraint_schema
|
|
53
|
+
and kcu.constraint_name = tco.constraint_name
|
|
54
|
+
where tco.constraint_type = 'PRIMARY KEY'
|
|
55
|
+
and kcu.table_schema = %s
|
|
56
|
+
and kcu.table_name = %s
|
|
57
|
+
order by kcu.ordinal_position
|
|
58
|
+
""",
|
|
59
|
+
(self.unescape_word(schema), self.unescape_word(table)),
|
|
60
|
+
)
|
|
55
61
|
]
|
|
56
62
|
return pk_columns or None
|
|
57
63
|
|
|
64
|
+
@staticmethod
|
|
65
|
+
def _to_row(row):
|
|
66
|
+
return {
|
|
67
|
+
"name": row[0],
|
|
68
|
+
"type": row[1],
|
|
69
|
+
"nullable": row[2].casefold() == "yes",
|
|
70
|
+
"default": row[3],
|
|
71
|
+
"autoincrement": row[4].casefold() == "always",
|
|
72
|
+
"identity": row[5].casefold() == "yes",
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@lru_cache(maxsize=None)
|
|
76
|
+
def get_column_names(
|
|
77
|
+
self, table: str, schema: str | None = None, predicate: Callable[[T], bool] = lambda column: True
|
|
78
|
+
) -> list[str] | None:
|
|
79
|
+
if schema is None:
|
|
80
|
+
table, schema = self.extract_schema_from_table(table)
|
|
81
|
+
|
|
82
|
+
column_names = list(
|
|
83
|
+
row["name"]
|
|
84
|
+
for row in filter(
|
|
85
|
+
predicate,
|
|
86
|
+
map(
|
|
87
|
+
self._to_row,
|
|
88
|
+
self.get_records(
|
|
89
|
+
"""
|
|
90
|
+
select column_name,
|
|
91
|
+
data_type,
|
|
92
|
+
is_nullable,
|
|
93
|
+
column_default,
|
|
94
|
+
is_generated,
|
|
95
|
+
is_identity
|
|
96
|
+
from information_schema.columns
|
|
97
|
+
where table_schema = %s
|
|
98
|
+
and table_name = %s
|
|
99
|
+
order by ordinal_position
|
|
100
|
+
""",
|
|
101
|
+
(self.unescape_word(schema), self.unescape_word(table)),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
self.log.debug("Column names for table '%s': %s", table, column_names)
|
|
107
|
+
return column_names
|
|
108
|
+
|
|
58
109
|
def generate_replace_sql(self, table, values, target_fields, **kwargs) -> str:
|
|
59
110
|
"""
|
|
60
111
|
Generate the REPLACE SQL statement.
|