potiuk commented on a change in pull request #4523: [AIRFLOW-3616] Add aliases 
for schema with underscore
URL: https://github.com/apache/airflow/pull/4523#discussion_r249286548
 
 

 ##########
 File path: airflow/models/connection.py
 ##########
 @@ -109,22 +109,24 @@ def __init__(
             self.extra = extra
 
     def parse_from_uri(self, uri):
-        temp_uri = urlparse(uri)
-        hostname = temp_uri.hostname or ''
-        conn_type = temp_uri.scheme
+        uri_parts = urlparse(uri)
+        hostname = uri_parts.hostname or ''
+        conn_type = uri_parts.scheme
         if conn_type == 'postgresql':
             conn_type = 'postgres'
+        elif '-' in conn_type:
+            conn_type = conn_type.replace('-', '_')
 
 Review comment:
   A general comment @mik-laj .  Should not we rather change the Google 
Connection scheme to be google-cloud-platform rather than replace '_' with '-' 
? I think it's more accurate, simply the google_cloud_platform scheme is wrong 
- according to https://tools.ietf.org/html/rfc3986#page-17  the scheme part of 
the URI can only contain alphanumeric characters, hyphen or dot. So urlparse 
behaves quite well and we should simply change the scheme to be 
google-cloud-platform

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to