amoghrajesh commented on code in PR #45448:
URL: https://github.com/apache/airflow/pull/45448#discussion_r1905269258


##########
task_sdk/src/airflow/sdk/definitions/connection.py:
##########
@@ -50,3 +55,32 @@ class Connection:
     def get_uri(self): ...
 
     def get_hook(self): ...
+
+    def _get_extra_dejson(self, nested: bool = False) -> dict:
+        """
+        Deserialize extra property to JSON.
+
+        :param nested: Determines whether nested structures are also 
deserialized into JSON (default False).
+        """
+        extra = {}
+        log = structlog.get_logger(logger_name="task")
+
+        if self.extra:
+            try:
+                if nested:
+                    for key, value in json.loads(self.extra).items():
+                        extra[key] = value
+                        if isinstance(value, str):
+                            with suppress(JSONDecodeError):
+                                extra[key] = json.loads(value)
+                else:
+                    extra = json.loads(self.extra)
+            except JSONDecodeError:
+                log.error("Failed to deserialize extra property `extra`, 
returning empty dictionary")

Review Comment:
   Yeah, i mentioned that I do not want to raise an exception, but log and move 
on.



-- 
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]

Reply via email to