ashb commented on a change in pull request #15425:
URL: https://github.com/apache/airflow/pull/15425#discussion_r641513080



##########
File path: airflow/cli/commands/connection_command.py
##########
@@ -238,39 +238,24 @@ def connections_delete(args):
 
 @cli_utils.action_logging
 def connections_import(args):
-    """Imports connections from a given file"""
+    """Imports connections from a file"""
     if os.path.exists(args.file):
         _import_helper(args.file)
     else:
         raise SystemExit("Missing connections file.")
 
 
 def _import_helper(file_path):
-    """Helps import connections from a file"""
-    connections_dict = load_connections_dict(file_path)
+    """Load connections from a file and save them to the DB. On collision, 
skip."""
+    connections_dict = _parse_secret_file(file_path)
     with create_session() as session:
-        for conn_id, conn_values in connections_dict.items():
+        for conn_id, conn_dict in connections_dict.items():
             if session.query(Connection).filter(Connection.conn_id == 
conn_id).first():
                 print(f'Could not import connection {conn_id}: connection 
already exists.')
                 continue
 
-            allowed_fields = [
-                'extra',
-                'description',
-                'conn_id',
-                'login',
-                'conn_type',
-                'host',
-                'password',
-                'schema',
-                'port',
-                'uri',
-                'extra_dejson',
-            ]
-            filtered_connection_values = {
-                key: value for key, value in conn_values.items() if key in 
allowed_fields
-            }
-            connection = _create_connection(conn_id, 
filtered_connection_values)
+            # Add the connection to the DB

Review comment:
       For compat we should add this
   
   ```suggestion
               if "extra_dejson" in conn_dict:
                   conn_dict["extra"] = conn_dict.pop("extra_dejson")
               # Add the connection to the DB
   ```




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