Opal Commands

Skip to end of metadata
Go to start of metadata

Overview


Using the Commands

Getting Help

Once in the console, the command syntax is the following:

<command> <options> <arguments>

where

  • command is an action to be performed.
  • options are switches, with or without values; every option has a long form (e.g., "--help") and a short form (e.g., "-h"). Every command supports the help option.
  • arguments are (unnamed) arguments applied to the action (e.g., a list of files).

Typing:

help

prints the general syntax and options.

The commands available are:

Command Description
copy Copy tables to an existing destination datasource or to a specified Excel file. The tables can be explicitly named and/or be the ones from a specified source datasource. The variables can be optionally processed: dispatched in another table and/or renamed.
decrypt Decrypts a list of Onyx data files into a directory.
help Display the list of available commands.
import Imports a list of Onyx data files to a destination datasource.
keystore Creates, deletes, imports and exports keypairs/certificates.
quit Quit the Opal console.
show Display the names of the available datasources and tables in the system.
split Splits one or more ZIP files into multiple pieces.
version Print the version number of Opal.

List of Commands

The following commands are available from the Opal console.

copy


Description

Copy tables to an existing destination datasource or to a specified Excel file. The tables can be explicitly named and/or be the ones from a specified source datasource. The variables can be optionally processed: dispatched in another table and/or renamed.

Use show command to get the list of datasources and tables declared in the system.

Syntax

copy [--source NAME] (--destination NAME | --out FILE) 
     [--multiplex SCRIPT] [--transform SCRIPT] 
     [--non-incremental] [--no-values | --no-variables] [TABLE_NAME...]

Arguments

  • None, and then requires the source option.
  • One or more fully qualified table names, that can be used in combination with the source option.

Options

Option Description
[--source NAME]
The name of the source datasource. If specified, all the tables from this datasource will be copied.
[--destination -d NAME]
The name of the datasource destination in which export the data. This datasource must be declared in the system. This option is exclusive to the out option.
[--out -o FILE]
The datasource destination is an Excel file. See note about Excel. This option is exclusive to the destination option.
[--multiplex -m SCRIPT]
Executes the specified SCRIPT to determine the destination table name. This is used to copy variables from one table to multiple tables. If this option is not used, default behaviour is to copy to a table with name of the original table. See Magma Javascript API for more details about how to write the script.
[--transform -t SCRIPT]
Executes the specified SCRIPT to determine the resulting variable's name. If this option is not used, default behaviour is to copy the variable with its original name. See Magma Javascript API for more details about how to write the script.
[--non-incremental -i]
Copies all value sets from the source tables without regard to prior copy operations.
[--no-variables -v]
Do not copy the variables.
[--no-values -l] Copies the variables only (as opposed to variables and data).

decrypt


Description

Decrypts a list of Onyx data files into a directory.

Syntax

decrypt [--out FILE] FILE [FILE...]

Arguments

The list of .zip files to be decrypted.

Options

Option Description
[--out -o FILE]
The directory into which the decrypted files are written. Default is current directory.

import


Description

Imports a list of Onyx data files into a destination datasource. If a directory is provided, all .zip files inside of it are assumed to be imported. After import, the files are moved to the archive directory (if specified).

The zip file's content can be encrypted using a public key. When this is the case, Opal will lookup the corresponding key-pair in it's keystore (see the keystore command). If the key-pair is not present, import will fail.

Syntax

import --unit NAME --destination NAME [--archive FILE] [FILE...]

Arguments

  • None: all the .zip files from the unit's directory are imported,
  • A list of files that can be either .zip files or directories that contains .zip files. The file paths can be absolute or relative. In the latter case the paths are assumed to be relative to the unit's directory.

Options

Option Description
[--archive -a FILE]
Archive directory. If a relative path is given, it is relative to the functional unit's directory.
--destination -d  NAME
The destination datasource into which the variable catalogue and the participants data will be imported.
--unit -u NAME
The functional unit.

keystore


Description

Encryption key pairs creation, import, export or deletion. The action option will select what is to be done.

A key pair can be added to the keystore by different ways:

  • created from scratch, providing the algorithm information,
  • imported, providing the pem file of the private key. Then the corresponding certificate can be:
    • created from scratch,
    • imported from a pem file.

Once a key pair is in the keystore, you can extract the public certificate using the action export.

Syntax

keystore [--unit NAME] --alias NAME 
         (--action create --algo NAME --size INT 
        | --action delete 
        | --action import --private FILE [--certificate FILE] 
        | --action export --certificate FILE))

Options

Option Description
--action -x (create|delete|import|export)
The action to perform: create, delete, import or export.
--alias -a NAME
The alias name of the encryption key pair.
[--algo -g NAME]
The algorithm for creating the key pair. RSA is recommended.
[--size -s INT]
The key size for creating the key pair.
[--private -p FILE]
Provides the private key file in pem format.
[--certificate -c FILE]
When importing: provides the certified public key file in pem format that matches the private key file. If omitted the user is prompt for creating one.
When exporting: pem file into which the public key will be written as a certificate. If omitted, the certificate will be written on console output.
[--unit -u NAME]
The functional unit, if not provided default is Opal instance itself.

show


Description

Display the fully qualified names of the available datasources and tables in the system. These names are the ones to be used when a datasource or a table name is to be provided on other command lines. Also displays the units to be provided on some command lines.

Syntax

show [--datasources] [--tables] [--units]

Options

Option Description
[--datasources -d] List the datasources names.
[--tables -t] List the tables fully qualified names.
[--units -u] List the functional units.

split


Description

Splits one or more ZIP files into multiple pieces.

Syntax

split --out DIR [--size size] FILE...

Arguments

One or more fully file names (must be Onyx export ZIP files)

Options

Option Description
--out -o DIR The output directory where the parts
[--size -s value] Maximum number of entities to write per file. Default is 500.
Search Opal Documentation
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.