justinpakzad commented on code in PR #61965:
URL: https://github.com/apache/airflow/pull/61965#discussion_r2814222053
##########
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py:
##########
@@ -476,9 +476,12 @@ def get_aws_iam_token(self, conn: Connection) ->
tuple[str, str, int]:
port = conn.port or 5439
# Pull the custer-identifier from the beginning of the Redshift URL
# ex. my-cluster.ccdre4hpd39h.us-east-1.redshift.amazonaws.com
returns my-cluster
- cluster_identifier = conn.extra_dejson.get(
- "cluster-identifier", cast("str", conn.host).split(".")[0]
- )
+ cluster_identifier = conn.extra_dejson.get("cluster-identifier")
+ if cluster_identifier is None and not conn.host:
+ raise ValueError(
+ "connection host is required for AWS IAM token when
cluster-identifier is not set in extras."
+ )
+ cluster_identifier = cluster_identifier or
(conn.host.split(".")[0] if conn.host else None)
Review Comment:
It was intentional but now that I'm having another look it should probably
only use the host when the user hasn't provided any cluster identifier in the
extras at all (only when its None, not necessarily an empty string or other
falsy vals). Good call out. Going to make that update.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]