frnidito opened a new issue #9060:
URL: https://github.com/apache/airflow/issues/9060


   **Description**
   
   The `Connection` object should be able to support repeated keys in the extra 
fields.
   
   **Use case / motivation**
   
   Some connections strings, for instance the one used by MongoDB, support the 
repetition of keys such as in setting the rules for the precedence in choosing 
data-centres:
   
   
`mongodb://mongos1.example.com,mongos2.example.com/?readPreference=secondary&readPreferenceTags=dc:ny,rack:r1&readPreferenceTags=dc:ny&readPreferenceTags=`
   
   At the moment, there is no way to set this in the Connection neither though 
the UI nor using the CLI.
   ```
   >>> from airflow.models.connection import Connection
   >>> c = 
Connection(uri='my-conn-type://my-login:my-password@my-host:5432/my-schema?param1=val1&param2=val2')
   >>> c.extra
   '{"param1": "val1", "param2": "val2"}'
   >>> c.set_extra('{"param1": "val1", "param1": "val2"}')  # <- here
   >>> c.get_uri()
   'my-conn-type://my-login:my-password@my-host:5432/my-schema?param1=val2'
   ```
   
   Adding support to this, maybe with an array form in the JSON would be ideal, 
i.e., being able to write something like:
   ```
   >>> c.set_extra('{"param1": ["val1", "val2"]}')
   >>> c.get_uri()
   
'my-conn-type://my-login:my-password@my-host:5432/my-schema?param1=val1&param1=val2'
   ```


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to