Lee-W commented on code in PR #57969:
URL: https://github.com/apache/airflow/pull/57969#discussion_r2501449969
##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -329,12 +329,27 @@ def get_uri(self) -> str:
if self.extra:
try:
- query: str | None = urlencode(self.extra_dejson)
- except TypeError:
- query = None
- if query and self.extra_dejson == dict(parse_qsl(query,
keep_blank_values=True)):
- uri += ("?" if self.schema else "/?") + query
- else:
+ extras_dict = self.extra_dejson
Review Comment:
This assignment is not needed
```suggestion
```
##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -329,12 +329,27 @@ def get_uri(self) -> str:
if self.extra:
try:
- query: str | None = urlencode(self.extra_dejson)
- except TypeError:
- query = None
- if query and self.extra_dejson == dict(parse_qsl(query,
keep_blank_values=True)):
- uri += ("?" if self.schema else "/?") + query
- else:
+ extras_dict = self.extra_dejson
+ has_unserializable = any(v in (None, "") for v in
extras_dict.values())
+
+ safe_extras = {
+ k: (
+ json.dumps(v)
+ if isinstance(v, (dict, list))
+ else str(v).lower()
+ if isinstance(v, bool)
+ else "null"
+ if v is None
+ else str(v)
Review Comment:
Let's turn this into a function instead. it's a bit hard to understand
--
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]