You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/02 07:27:39 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #9907: Added feature to Import connections from a file.

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



##########
File path: airflow/cli/cli_parser.py
##########
@@ -626,6 +626,20 @@ def positive_int(value):
     ),
     action="store_true",
     default=False)
+ARG_CONN_IMPORT = Arg(
+    ('file',),
+    help='Import connections from a file. Acceptable file formats .json, .yaml, .env',
+    type=str)

Review comment:
       ```suggestion
       type=str)
   ```
   Have you considered using argparse.Filetype?
   https://docs.python.org/3/library/argparse.html#argparse.FileType
   This way, you will be able to export data directly to stdout.
   ```
   airflow connections export - | grep MY_CON
   ```Have you considered using argparse.Filetype?
   https://docs.python.org/3/library/argparse.html#argparse.FileType
   This way, you will be able to import data directly from stdout.
   ```
   cat my-file.json | airflow connections export - --format=json
   ```




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