From ccb260e481d1c292998c1086f777ef17eb787e94 Mon Sep 17 00:00:00 2001 From: Michael Black Date: Fri, 27 Mar 2026 21:11:24 -0600 Subject: [PATCH] Remove false-positive RFC3986 underscore warning from Connection.get_uri() `get_uri()` warns about underscores in `conn_type`, but standard Airflow connection types like `google_cloud_platform` inherently contain underscores. The warning is not actionable for users since: 1. Standard provider connection types (google_cloud_platform, etc.) are defined with underscores by the providers themselves 2. `get_uri()` already handles this correctly on the very next line by converting underscores to dashes: `self.conn_type.lower().replace('_', '-')` 3. Connections stored via Secrets Manager backends trigger this warning on every connection retrieval during task execution, producing noisy logs with no remediation path The underscore-to-dash conversion in the URI output remains intact, ensuring RFC3986 compliance of the generated URI. Co-Authored-By: Claude Opus 4.6 (1M context) --- task-sdk/src/airflow/sdk/definitions/connection.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/task-sdk/src/airflow/sdk/definitions/connection.py b/task-sdk/src/airflow/sdk/definitions/connection.py index 21eed4216f52f..edb65ed7a94ab 100644 --- a/task-sdk/src/airflow/sdk/definitions/connection.py +++ b/task-sdk/src/airflow/sdk/definitions/connection.py @@ -157,11 +157,6 @@ def get_uri(self) -> str: """Generate and return connection in URI format.""" from urllib.parse import parse_qsl - if self.conn_type and "_" in self.conn_type: - log.warning( - "Connection schemes (type: %s) shall not contain '_' according to RFC3986.", - self.conn_type, - ) if self.conn_type: uri = f"{self.conn_type.lower().replace('_', '-')}://" else: