Skip to content

annotated arguments don't work in python 3.9 "no such option"

When running mqdbt component download the required arguments --sn and --output-dir do not work with python 3.9

If run mqdbt component download -h this is the help display where in the Arguments field you'd expect the CLI options shown, but they're empty

$ mqdbt component download  -h
                                                                                                                              
 Usage: mqdbt component download [OPTIONS] SERIAL_NUMBER OUTPUT_DIR                                                           
                                                                                                                              
 Main executable for downloading components from production database to disk.                                                 
                                                                                                                              
 This will:                                                                                                                   
 - download all test run results                                                                                              
 - download all attachments                                                                                                   
 - extract (`Attachment_Pack.zip`) attachment packs                                                                           
 - extract (`RAW`) measurement inputs for `module-qc-analysis-tools`                                                          
 - generate (`analysis.json`) analysis output from `module-qc-analysis-tools` from the test run results                       
                                                                                                                              
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    serial_number      TEXT  [default: None] [required]                                                                   │
│ *    output_dir         PATH  [default: None] [required]                                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --accessCode1                        TEXT  Access Code 1 for production DB [default: None]                                 │
│ --accessCode2                        TEXT  Access Code 2 for production DB [default: None]                                 │
│ --test-type                          TEXT  [default: None]                                                                 │
│ --stage                              TEXT  [default: None]                                                                 │
│ --dry-run          --no-dry-run            [default: no-dry-run]                                                           │
│ --overwrite        --no-overwrite          [default: no-overwrite]                                                         │
│ --help         -h                          Show this message and exit.                                                     │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

If one tries to supply --sn you get

image

I observed this on my python 3.2.21 and can reproduce in new python environments with python 3.9.15 and python 3.9.23. Tried also with python 3.10.18 which works fine. For the record this is how the help is supposed to look like

$ mqdbt component download  -h
                                                                                                                              
 Usage: mqdbt component download [OPTIONS]                                                                                    
                                                                                                                              
 Main executable for downloading components from production database to disk.                                                 
                                                                                                                              
 This will:                                                                                                                   
 - download all test run results                                                                                              
 - download all attachments                                                                                                   
 - extract (`Attachment_Pack.zip`) attachment packs                                                                           
 - extract (`RAW`) measurement inputs for `module-qc-analysis-tools`                                                          
 - generate (`analysis.json`) analysis output from `module-qc-analysis-tools` from the test run results                       
                                                                                                                              
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --sn,--serial-number          TEXT  Module serial number [default: None] [required]                                     │
│ *  --output-dir                  PATH  Directory to save the files [default: None] [required]                              │
│    --accessCode1                 TEXT  Access Code 1 for production DB [default: None]                                     │
│    --accessCode2                 TEXT  Access Code 2 for production DB [default: None]                                     │
│    --test-type                   TEXT  Filter by test type code [default: None]                                            │
│    --stage                       TEXT  Filter by stage [default: None]                                                     │
│    --dry-run             -n            Dry run, do not create or modify anything.                                          │
│    --overwrite                         Overwrite existing files                                                            │
│    --help                -h            Show this message and exit.                                                         │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Edited by Lingxin Meng