apache-airflow-providers-postgres 5.13.1rc1__py3-none-any.whl → 5.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "5.13.1"
32
+ __version__ = "5.14.0"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.8.0"
@@ -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": 1728485329,
31
+ "source-date-epoch": 1731570750,
32
32
  "versions": [
33
+ "5.14.0",
33
34
  "5.13.1",
34
35
  "5.13.0",
35
36
  "5.12.0",
@@ -72,7 +73,7 @@ def get_provider_info():
72
73
  ],
73
74
  "dependencies": [
74
75
  "apache-airflow>=2.8.0",
75
- "apache-airflow-providers-common-sql>=1.17.0",
76
+ "apache-airflow-providers-common-sql>=1.20.0",
76
77
  "psycopg2-binary>=2.9.4",
77
78
  ],
78
79
  "additional-extras": [{"name": "amazon", "dependencies": ["apache-airflow-providers-amazon>=2.6.0"]}],
@@ -59,11 +59,17 @@ class PostgresHook(DbApiHook):
59
59
  "aws_default" connection to get the temporary token unless you override
60
60
  in extras.
61
61
  extras example: ``{"iam":true, "aws_conn_id":"my_aws_conn"}``
62
+
62
63
  For Redshift, also use redshift in the extra connection parameters and
63
64
  set it to true. The cluster-identifier is extracted from the beginning of
64
65
  the host field, so is optional. It can however be overridden in the extra field.
65
66
  extras example: ``{"iam":true, "redshift":true, "cluster-identifier": "my_cluster_id"}``
66
67
 
68
+ For Redshift Serverless, use redshift-serverless in the extra connection parameters and
69
+ set it to true. The workgroup-name is extracted from the beginning of
70
+ the host field, so is optional. It can however be overridden in the extra field.
71
+ extras example: ``{"iam":true, "redshift-serverless":true, "workgroup-name": "my_serverless_workgroup"}``
72
+
67
73
  :param postgres_conn_id: The :ref:`postgres conn id <howto/connection:postgres>`
68
74
  reference to a specific postgres database.
69
75
  :param options: Optional. Specifies command-line options to send to the server
@@ -172,8 +178,10 @@ class PostgresHook(DbApiHook):
172
178
  if arg_name not in [
173
179
  "iam",
174
180
  "redshift",
181
+ "redshift-serverless",
175
182
  "cursor",
176
183
  "cluster-identifier",
184
+ "workgroup-name",
177
185
  "aws_conn_id",
178
186
  ]:
179
187
  conn_args[arg_name] = arg_val
@@ -247,9 +255,9 @@ class PostgresHook(DbApiHook):
247
255
  try:
248
256
  from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
249
257
  except ImportError:
250
- from airflow.exceptions import AirflowException
258
+ from airflow.exceptions import AirflowOptionalProviderFeatureException
251
259
 
252
- raise AirflowException(
260
+ raise AirflowOptionalProviderFeatureException(
253
261
  "apache-airflow-providers-amazon not installed, run: "
254
262
  "pip install 'apache-airflow-providers-postgres[amazon]'."
255
263
  )
@@ -262,7 +270,7 @@ class PostgresHook(DbApiHook):
262
270
  # ex. my-cluster.ccdre4hpd39h.us-east-1.redshift.amazonaws.com returns my-cluster
263
271
  cluster_identifier = conn.extra_dejson.get("cluster-identifier", conn.host.split(".")[0])
264
272
  redshift_client = AwsBaseHook(aws_conn_id=aws_conn_id, client_type="redshift").conn
265
- # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift.html#Redshift.Client.get_cluster_credentials
273
+ # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift/client/get_cluster_credentials.html#Redshift.Client.get_cluster_credentials
266
274
  cluster_creds = redshift_client.get_cluster_credentials(
267
275
  DbUser=login,
268
276
  DbName=self.database or conn.schema,
@@ -271,10 +279,26 @@ class PostgresHook(DbApiHook):
271
279
  )
272
280
  token = cluster_creds["DbPassword"]
273
281
  login = cluster_creds["DbUser"]
282
+ elif conn.extra_dejson.get("redshift-serverless", False):
283
+ port = conn.port or 5439
284
+ # Pull the workgroup-name from the query params/extras, if not there then pull it from the
285
+ # beginning of the Redshift URL
286
+ # ex. workgroup-name.ccdre4hpd39h.us-east-1.redshift.amazonaws.com returns workgroup-name
287
+ workgroup_name = conn.extra_dejson.get("workgroup-name", conn.host.split(".")[0])
288
+ redshift_serverless_client = AwsBaseHook(
289
+ aws_conn_id=aws_conn_id, client_type="redshift-serverless"
290
+ ).conn
291
+ # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift-serverless/client/get_credentials.html#RedshiftServerless.Client.get_credentials
292
+ cluster_creds = redshift_serverless_client.get_credentials(
293
+ dbName=self.database or conn.schema,
294
+ workgroupName=workgroup_name,
295
+ )
296
+ token = cluster_creds["dbPassword"]
297
+ login = cluster_creds["dbUser"]
274
298
  else:
275
299
  port = conn.port or 5432
276
300
  rds_client = AwsBaseHook(aws_conn_id=aws_conn_id, client_type="rds").conn
277
- # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.generate_db_auth_token
301
+ # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds/client/generate_db_auth_token.html#RDS.Client.generate_db_auth_token
278
302
  token = rds_client.generate_db_auth_token(conn.host, port, conn.login)
279
303
  return login, token, port
280
304
 
@@ -371,9 +395,9 @@ class PostgresHook(DbApiHook):
371
395
  try:
372
396
  from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
373
397
  except ImportError:
374
- from airflow.exceptions import AirflowException
398
+ from airflow.exceptions import AirflowOptionalProviderFeatureException
375
399
 
376
- raise AirflowException(
400
+ raise AirflowOptionalProviderFeatureException(
377
401
  "apache-airflow-providers-amazon not installed, run: "
378
402
  "pip install 'apache-airflow-providers-postgres[amazon]'."
379
403
  )
@@ -18,7 +18,7 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  import warnings
21
- from typing import Mapping
21
+ from typing import ClassVar, Mapping
22
22
 
23
23
  from deprecated import deprecated
24
24
 
@@ -55,7 +55,10 @@ class PostgresOperator(SQLExecuteQueryOperator):
55
55
  Deprecated - use `hook_params={'options': '-c <connection_options>'}` instead.
56
56
  """
57
57
 
58
- template_fields_renderers = {**SQLExecuteQueryOperator.template_fields_renderers, "sql": "postgresql"}
58
+ template_fields_renderers: ClassVar[dict] = {
59
+ **SQLExecuteQueryOperator.template_fields_renderers,
60
+ "sql": "postgresql",
61
+ }
59
62
  ui_color = "#ededed"
60
63
 
61
64
  def __init__(
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: apache-airflow-providers-postgres
3
- Version: 5.13.1rc1
3
+ Version: 5.14.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>
@@ -20,21 +20,21 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow-providers-common-sql>=1.17.0rc0
24
- Requires-Dist: apache-airflow>=2.8.0rc0
23
+ Requires-Dist: apache-airflow-providers-common-sql>=1.20.0
24
+ Requires-Dist: apache-airflow>=2.8.0
25
25
  Requires-Dist: psycopg2-binary>=2.9.4
26
- Requires-Dist: apache-airflow-providers-amazon>=2.6.0rc0 ; extra == "amazon"
27
- Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
26
+ Requires-Dist: apache-airflow-providers-amazon>=2.6.0 ; extra == "amazon"
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.13.1/changelog.html
31
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.13.1
30
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.14.0/changelog.html
31
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.14.0
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
35
35
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
36
36
  Provides-Extra: amazon
37
- Provides-Extra: common.sql
37
+ Provides-Extra: common-sql
38
38
  Provides-Extra: openlineage
39
39
 
40
40
 
@@ -81,7 +81,7 @@ Provides-Extra: openlineage
81
81
 
82
82
  Package ``apache-airflow-providers-postgres``
83
83
 
84
- Release: ``5.13.1.rc1``
84
+ Release: ``5.14.0``
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.13.1/>`_.
97
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.14.0/>`_.
98
98
 
99
99
  Installation
100
100
  ------------
@@ -112,7 +112,7 @@ Requirements
112
112
  PIP package Version required
113
113
  ======================================= ==================
114
114
  ``apache-airflow`` ``>=2.8.0``
115
- ``apache-airflow-providers-common-sql`` ``>=1.17.0``
115
+ ``apache-airflow-providers-common-sql`` ``>=1.20.0``
116
116
  ``psycopg2-binary`` ``>=2.9.4``
117
117
  ======================================= ==================
118
118
 
@@ -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.13.1/changelog.html>`_.
141
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-postgres/5.14.0/changelog.html>`_.
@@ -0,0 +1,13 @@
1
+ airflow/providers/postgres/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
2
+ airflow/providers/postgres/__init__.py,sha256=VnUmUbfP12iJQKXxosuS_8zJJB288x3BQU8jUPuZONQ,1496
3
+ airflow/providers/postgres/get_provider_info.py,sha256=he8tks-iUep0xlL9MuRTMyjcfbj8_a9SPvi7BVmTkW0,3945
4
+ airflow/providers/postgres/assets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
+ airflow/providers/postgres/assets/postgres.py,sha256=XNhOJCbOA_soaaiS73JjULMqAM_7PBryhToe8FJREA0,1522
6
+ airflow/providers/postgres/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
7
+ airflow/providers/postgres/hooks/postgres.py,sha256=0sJm85AhKmXrKHrgpG9GexLo0F_nRcjgC5i-gc5qOuM,18377
8
+ airflow/providers/postgres/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
9
+ airflow/providers/postgres/operators/postgres.py,sha256=SWhsQlwcT434NH32Z45rivAQhGFMlFXwPn1JSc1iQsk,3558
10
+ apache_airflow_providers_postgres-5.14.0.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
11
+ apache_airflow_providers_postgres-5.14.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
12
+ apache_airflow_providers_postgres-5.14.0.dist-info/METADATA,sha256=BC73iqrdAU6jcE8k2Z6ZElEuUhQxxsKqaBMtNtRFAwg,6559
13
+ apache_airflow_providers_postgres-5.14.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.9.0
2
+ Generator: flit 3.10.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,13 +0,0 @@
1
- airflow/providers/postgres/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
2
- airflow/providers/postgres/__init__.py,sha256=_lebFA9TQjPxjEZvHBEM-0ugjpNBGApqcmewvIc6nDY,1496
3
- airflow/providers/postgres/get_provider_info.py,sha256=4juIGYKo-06GIqC1GJny6srL1aHijGMEnHY3Wof5-BA,3923
4
- airflow/providers/postgres/assets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
- airflow/providers/postgres/assets/postgres.py,sha256=XNhOJCbOA_soaaiS73JjULMqAM_7PBryhToe8FJREA0,1522
6
- airflow/providers/postgres/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
7
- airflow/providers/postgres/hooks/postgres.py,sha256=MQwBq8js4vW7MVbocJMW_rPZzhea5UhmdySPqkPK0Fw,16738
8
- airflow/providers/postgres/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
9
- airflow/providers/postgres/operators/postgres.py,sha256=M8qx8FBf97HRwJMn_zg_EqCPGqsx-iZ0aRzMQuG3lJg,3509
10
- apache_airflow_providers_postgres-5.13.1rc1.dist-info/entry_points.txt,sha256=dhtJi6PTWHd6BwKhmI4OtSPvQVI_p0yYWI0eba83HqY,104
11
- apache_airflow_providers_postgres-5.13.1rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
12
- apache_airflow_providers_postgres-5.13.1rc1.dist-info/METADATA,sha256=45C7pO5zYlnzq1QzR4GZEZvNZd8fo3F1MqTUfG7XPPI,6575
13
- apache_airflow_providers_postgres-5.13.1rc1.dist-info/RECORD,,