Built-in Commands

Below are the subcommands which come with WuttaSync.

It is fairly simple to add more; see Custom Commands.

wutta export-csv

Export data from the Wutta app database to CSV file(s).

This should be able to automatically export any table mapped in the app model. The only caveat is that it is “dumb” and does not have any special field handling. This means the column headers in the CSV will be the same as in the source table, and some data types may not behave as expected etc.

Defined in: wuttasync.cli.export_csv

                                                                                
 Usage: wutta export-csv [OPTIONS] [MODELS]...                                  
                                                                                
 Export data from Wutta DB to CSV file(s)                                       
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│   models      [MODELS]...  Target model(s) to process.  Specify one or more, │
│                            or omit to process default models.                │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --list-models     -l                          List available target models   │
│                                               and exit.                      │
│ --create              --no-create             Allow new target records to be │
│                                               created.  See aso              │
│                                               --max-create.                  │
│                                               [default: create]              │
│ --update              --no-update             Allow existing target records  │
│                                               to be updated.  See also       │
│                                               --max-update.                  │
│                                               [default: update]              │
│ --delete              --no-delete             Allow existing target records  │
│                                               to be deleted.  See also       │
│                                               --max-delete.                  │
│                                               [default: no-delete]           │
│ --fields                             TEXT     List of fields to process.     │
│                                               See also --exclude and --key.  │
│ --exclude                            TEXT     List of fields *not* to        │
│                                               process.  See also --fields.   │
│ --key,--keys                         TEXT     List of fields to use as       │
│                                               record key/identifier.  See    │
│                                               also --fields.                 │
│ --max-create                         INTEGER  Max number of target records   │
│                                               to create (per model).  See    │
│                                               also --create.                 │
│ --max-update                         INTEGER  Max number of target records   │
│                                               to update (per model).  See    │
│                                               also --update.                 │
│ --max-delete                         INTEGER  Max number of target records   │
│                                               to delete (per model).  See    │
│                                               also --delete.                 │
│ --max-total                          INTEGER  Max number of *any* target     │
│                                               record changes which may occur │
│                                               (per model).                   │
│ --warn            -W                          Expect no changes; warn (email │
│                                               the diff) if any occur.        │
│ --recip,--recips                     TEXT     Override the recipient(s) for  │
│                                               diff warning email.            │
│ --max-diffs                          INTEGER  Max number of record diffs to  │
│                                               show (per model) in warning    │
│                                               email.                         │
│                                               [default: 15]                  │
│ --dry-run                                     Go through the motions, but    │
│                                               rollback the transaction.      │
│ --output          -o                 PATH     Path to output folder.  Or     │
│                                               full path to output file if    │
│                                               only running one target model. │
│ --help                                        Show this message and exit.    │
╰──────────────────────────────────────────────────────────────────────────────╯

wutta import-csv

Import data from CSV file(s) to the Wutta app database.

This should be able to automatically target any table mapped in the app model. The only caveat is that it is “dumb” and does not have any special field handling. This means the column headers in the CSV file must be named the same as in the target table, and some data types may not behave as expected etc.

Defined in: wuttasync.cli.import_csv

                                                                                
 Usage: wutta import-csv [OPTIONS] [MODELS]...                                  
                                                                                
 Import data from CSV file(s) to Wutta DB                                       
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│   models      [MODELS]...  Target model(s) to process.  Specify one or more, │
│                            or omit to process default models.                │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --list-models     -l                          List available target models   │
│                                               and exit.                      │
│ --create              --no-create             Allow new target records to be │
│                                               created.  See aso              │
│                                               --max-create.                  │
│                                               [default: create]              │
│ --update              --no-update             Allow existing target records  │
│                                               to be updated.  See also       │
│                                               --max-update.                  │
│                                               [default: update]              │
│ --delete              --no-delete             Allow existing target records  │
│                                               to be deleted.  See also       │
│                                               --max-delete.                  │
│                                               [default: no-delete]           │
│ --fields                             TEXT     List of fields to process.     │
│                                               See also --exclude and --key.  │
│ --exclude                            TEXT     List of fields *not* to        │
│                                               process.  See also --fields.   │
│ --key,--keys                         TEXT     List of fields to use as       │
│                                               record key/identifier.  See    │
│                                               also --fields.                 │
│ --max-create                         INTEGER  Max number of target records   │
│                                               to create (per model).  See    │
│                                               also --create.                 │
│ --max-update                         INTEGER  Max number of target records   │
│                                               to update (per model).  See    │
│                                               also --update.                 │
│ --max-delete                         INTEGER  Max number of target records   │
│                                               to delete (per model).  See    │
│                                               also --delete.                 │
│ --max-total                          INTEGER  Max number of *any* target     │
│                                               record changes which may occur │
│                                               (per model).                   │
│ --warn            -W                          Expect no changes; warn (email │
│                                               the diff) if any occur.        │
│ --recip,--recips                     TEXT     Override the recipient(s) for  │
│                                               diff warning email.            │
│ --max-diffs                          INTEGER  Max number of record diffs to  │
│                                               show (per model) in warning    │
│                                               email.                         │
│                                               [default: 15]                  │
│ --dry-run                                     Go through the motions, but    │
│                                               rollback the transaction.      │
│ --input           -i                 PATH     Path to input folder.  Or full │
│                                               path to input file if only     │
│                                               running one target model.      │
│ --help                                        Show this message and exit.    │
╰──────────────────────────────────────────────────────────────────────────────╯

wutta import-versions

Import latest data to version tables, for the Wutta app database.

The purpose of this is to ensure version tables accurately reflect the current “live” data set, for given table(s). It is only relevant/usable if versioning is configured and enabled. For more on that see Wutta-Continuum.

This command can check/update version tables for any versioned class in the app model.

Defined in: wuttasync.cli.import_versions

                                                                                
 Usage: wutta import-versions [OPTIONS] [MODELS]...                             
                                                                                
 Import latest data to version tables, for Wutta DB                             
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│   models      [MODELS]...  Target model(s) to process.  Specify one or more, │
│                            or omit to process default models.                │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --list-models     -l                          List available target models   │
│                                               and exit.                      │
│ --create              --no-create             Allow new target records to be │
│                                               created.  See aso              │
│                                               --max-create.                  │
│                                               [default: create]              │
│ --update              --no-update             Allow existing target records  │
│                                               to be updated.  See also       │
│                                               --max-update.                  │
│                                               [default: update]              │
│ --delete              --no-delete             Allow existing target records  │
│                                               to be deleted.  See also       │
│                                               --max-delete.                  │
│                                               [default: no-delete]           │
│ --fields                             TEXT     List of fields to process.     │
│                                               See also --exclude and --key.  │
│ --exclude                            TEXT     List of fields *not* to        │
│                                               process.  See also --fields.   │
│ --key,--keys                         TEXT     List of fields to use as       │
│                                               record key/identifier.  See    │
│                                               also --fields.                 │
│ --max-create                         INTEGER  Max number of target records   │
│                                               to create (per model).  See    │
│                                               also --create.                 │
│ --max-update                         INTEGER  Max number of target records   │
│                                               to update (per model).  See    │
│                                               also --update.                 │
│ --max-delete                         INTEGER  Max number of target records   │
│                                               to delete (per model).  See    │
│                                               also --delete.                 │
│ --max-total                          INTEGER  Max number of *any* target     │
│                                               record changes which may occur │
│                                               (per model).                   │
│ --warn            -W                          Expect no changes; warn (email │
│                                               the diff) if any occur.        │
│ --recip,--recips                     TEXT     Override the recipient(s) for  │
│                                               diff warning email.            │
│ --max-diffs                          INTEGER  Max number of record diffs to  │
│                                               show (per model) in warning    │
│                                               email.                         │
│                                               [default: 15]                  │
│ --dry-run                                     Go through the motions, but    │
│                                               rollback the transaction.      │
│ --help                                        Show this message and exit.    │
╰──────────────────────────────────────────────────────────────────────────────╯