ashb commented on pull request #15425:
URL: https://github.com/apache/airflow/pull/15425#issuecomment-849583630


   And another idea: we possibly don't even need a new `from_dict` method.
   
   Instead we could make the Connection constructor take an `extra_dejson` 
argument:
   
   ```python
       def __init__(  # pylint: disable=too-many-arguments
           self,
           ...
           extra: Optional[str] = None,
           uri: Optional[str] = None,
           extra_dejson: Optional[str] = None,
       ):
           super().__init__()
   
           ...
   
           if extra_dejson:
               self.extra = json.dumps(extra_dejson)
   ```
   
   Though the "de" part of this name is wrong/confusing.
   
   Another options would be to have `Connection()` accept a dict as extra and 
jsonify it:
   
   ```python
       def __init__(  # pylint: disable=too-many-arguments
           self,
           ...
           extra: Union[str,dict] = None,
           uri: Optional[str] = None,
   
       ):
           super().__init__()
   
           ...
   
           if not isinstance(extra, str):
               extra = json.dumps(extra)
   ```
   
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to