mik-laj commented on a change in pull request #12764:
URL: https://github.com/apache/airflow/pull/12764#discussion_r535096096



##########
File path: airflow/cli/commands/connection_command.py
##########
@@ -140,20 +136,19 @@ def connections_export(args):
             _, filetype = os.path.splitext(args.file.name)
             filetype = filetype.lower()
             if filetype not in allowed_formats:
-                msg = (
-                    f"Unsupported file format. "
-                    f"The file must have the extension {', 
'.join(allowed_formats)}"
+                raise SystemExit(
+                    f"Unsupported file format. The file must have "
+                    f"the extension {', '.join(allowed_formats)}."
                 )
-                raise SystemExit(msg)
 
         connections = 
session.query(Connection).order_by(Connection.conn_id).all()
         msg = _format_connections(connections, filetype)
         args.file.write(msg)
 
         if _is_stdout(args.file):
-            print("Connections successfully exported.", file=sys.stderr)
+            print(f"Connections successfully exported to {args.file.name}.")
         else:
-            print(f"Connections successfully exported to {args.file.name}")
+            print("Connections successfully exported.", file=sys.stderr)

Review comment:
       Before:
   ```
   $ airflow connections export - | jq .
   ....
     "yandexcloud_default": {
       "conn_type": "yandexcloud",
       "description": null,
       "host": null,
       "login": null,
       "password": null,
       "schema": "default",
       "port": null,
       "extra": null
     }
   }
   ```
   After
   ```
   $ airflow connections export - | jq .
   .....
       "login": null,
       "password": null,
       "schema": "default",
       "port": null,
       "extra": null
     }
   }
   parse error: Invalid numeric literal at line 472, column 13
   ```
   




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