Taragolis commented on issue #28766:
URL: https://github.com/apache/airflow/issues/28766#issuecomment-1375346374
@aru-trackunit Ahhh... I see. I've just check and able to reproduce your
problem.
URI
`aws:///?endpoint_url=https%3A%2F%2Fs3.eu-west-1.amazonaws.com®ion_name=eu-west-1`
is valid for Connection.
```python
Python 3.9.10 (main, Feb 25 2022, 16:54:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.7.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 8.7.0
Python 3.9.10 (main, Feb 25 2022, 16:54:01)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
In[2]: from airflow.models.connection import Connection
In[3]: conn =
Connection(uri="aws:///?endpoint_url=https%3A%2F%2Fs3.eu-west-1.amazonaws.com®ion_name=eu-west-1")
In[4]: conn.host
Out[4]: ''
In[5]: conn.extra_dejson
Out[5]:
{'endpoint_url': 'https://s3.eu-west-1.amazonaws.com',
'region_name': 'eu-west-1'}
```
But unfortunetly it is not valid for cli. So there is actually exists
inconsistency between cli `airflow connections add` and
`airflow.models.connection.Connection`. Connection URI created by `Connection`
could be invalid for cli in case if all fields `host`, `login`, `password`,
`port` are empty.
https://github.com/apache/airflow/blob/71306b31f1842ee2b1eb1cc2980b90f0fb6b11dc/airflow/cli/commands/connection_command.py#L133-L138
There is no problem with Amazon Provider as well as Deprecation Warning,
however problem exists in core.
As workaround you could add `@` instead of empty `host` for now
```console
❯ airflow connections add connection_id_1 --conn-uri
"aws://@/?endpoint_url=https%3A%2F%2Fs3.eu-west-1.amazonaws.com®ion_name=eu-west-1"
Successfully added `conn_id`=connection_id_1 :
aws://@/?endpoint_url=https%3A%2F%2Fs3.eu-west-1.amazonaws.com®ion_name=eu-west-1
❯ airflow connections get connection_id_3
id | conn_id | conn_type | description | host | schema | login |
password | port | is_encrypted | is_extra_encrypted | extra_dejson
| get_uri
===+=================+===========+=============+======+========+=======+==========+======+==============+====================+==========================+===========================
60 | connection_id_1 | aws | None | | | |
None | None | False | False | {'endpoint_url':
| aws:///?endpoint_url=https
| | | | | | |
| | | | 'https://s3.eu-west-1.am |
%3A%2F%2Fs3.eu-west-1.amaz
| | | | | | |
| | | | azonaws.com', |
onaws.com®ion_name=eu-w
| | | | | | |
| | | | 'region_name': |
est-1
| | | | | | |
| | | | 'eu-west-1'} |
```
Reopen Issue
--
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]