DataTable commands
Managing DataTables from the mabl CLI
In the mabl CLI, you can programmatically list, query, create, update, and export DataTables from your workspace.
Mabl CLI documentation
To display CLI documentation for DataTable commands, run
mabl datatables -h
ormabl datatables --help
.
mabl datatables list
List DataTables in a workspace.
$ mabl datatables list <optional_arguments>
Optional arguments
Option | Details |
---|---|
--workspace-id , -w | Workspace ID to list DataTables for. By default, the mabl CLI uses the workspace that appears in the output for the mabl config list command. |
--limit , -l | The number of DataTables to return. The default is 10. |
--output , -o | Specify the output format. The default is a table. Choices: "yaml, "json". |
Output
The mabl datatables list
command returns a table with DataTable IDs, names, and the date they were created.
┌──────────────────────────┬─────────────────────────────────┬─────────────────────────┐
│ ID │ Name │ Created time │
├──────────────────────────┼─────────────────────────────────┼─────────────────────────┤
│ <datatable-id> │ Localization │ Oct 29th 2019, 22:06:55 │
├──────────────────────────┼─────────────────────────────────┼─────────────────────────┤
│ <datatable-id> │ Login check │ Mar 19th 2020, 14:15:01 │
├──────────────────────────┼─────────────────────────────────┼─────────────────────────┤
│ <datatable-id> │ Sample data │ Mar 23rd 2020, 17:57:23 │
├──────────────────────────┼─────────────────────────────────┼─────────────────────────┤
│ <datatable-id> │ Example scenarios │ Jun 16th 2022, 01:28:37 │
└──────────────────────────┴─────────────────────────────────┴─────────────────────────┘
Examples
# List 20 DataTables in the workspace
$ `mabl datatables list --limit 20 `
# List DataTables in yaml format
$ `mabl datatables list --output yaml`
# List five DataTables in json format
$ `mabl datatables list --limit 5 --output json`
mabl datatables describe
Describe a specific DataTable by its DataTable ID.
Optional arguments
Option | Details |
---|---|
--output , -o | Specify the output format. The default is yaml. Choices: "json", "yaml". |
Output
The mabl datatables describe
command returns details on the specific DataTable, including workspace ID, name of the DataTable, scenario IDs, time created and by whom, time last updated and by whom.
id: <datatable_id>
organization_id: <workspace_id>
name: <name of datatable>
scenario_ids:
- <scenario_id>
- <scenario_id>
- <scenario_id>
created_time: 1668189822349
created_by_id: <user_id>
last_updated_time: 1673469977382
last_updated_by_id: <user_id>
Examples
# Describe DataTable in JSON format
$ mabl datatables describe <datatable-id> --format json
mabl datatables create
Create a DataTable from a JSON or CSV file. The file input should be a relative path to the file you are using to create the DataTable.
$ mabl datatables create <file-input> <optional_arguments>
Optional arguments
Option | Details |
---|---|
--workspace-id , -w | Workspace ID to create the DataTable in. By default, the mabl CLI uses the workspace that appears in the output for the mabl config list command. |
--name , --table-name | The name of your new DataTable. If no name is provided, the DataTable name is the name of the file. |
--format , --fmt | If the file input is missing the file extension, specify the format of your input file: "json" or "csv". |
File input
JSON format
[
{
"name": "English",
"variables": [
{
"name": "login",
"value": "Login"
},
{
"name": "greeting",
"value": "Welcome back"
},
{
"name": "logout",
"value": "Logout"
}
]
},
{
"name": "Spanish",
"variables": [
{
"name": "login",
"value": "Iniciar sesión"
},
{
"name": "greeting",
"value": "Qué bueno verte de nuevo"
},
{
"name": "logout",
"value": "Cerrar sesión"
}
]
}
]
CSV
Scenario name, login, greeting, logout
English, Login, Welcome back, Logout
Spanish, Iniciar sesión, Qué bueno verte de nuevo, Cerrar sesión
Output
When you create a DataTable, the mabl CLI returns details on the new DataTable, including workspace ID, name of DataTable, scenario IDs, time created and by whom, time last updated and by whom.
id: <datatable_id>
organization_id: <workspace_id>
name: <name of datatable>
scenario_ids:
- <scenario_id>
- <scenario_id>
- <scenario_id>
created_time: 1668189822349
created_by_id: <user_id>
last_updated_time: 1673469977382
last_updated_by_id: <user_id>
Examples
# Create a DataTable from a JSON file
$ mabl datatables create login_check.json --name "Login check"
# Create a DataTable from a CSV file and name it "Sample data"
$ mabl datatables create samples.csv --name "Sample data"
mabl datatables update
Update a mabl DataTable with a JSON or CSV file. The file input should be a relative path to the file you are using to update the DataTable.
$ mabl datatables update <datatable-id> <file-input>
Optional arguments
Option | Details |
---|---|
--workspace-id , -w | Workspace ID to create the DataTable in. By default, the mabl CLI uses the workspace that appears in the output for the mabl config list command. |
--format , --fmt | If the file input is missing the file extension, specify the format of your input file: "json" or "csv". |
Examples
# Update a DataTable from a JSON file called test.json
$ mabl datatables update <datatable-id> test.json
# Update a DataTable from a CSV file called test.csv
$ mabl datatables update <datatable-id> test.csv
mabl datatables export
Export a mabl DataTable in a specified file format.
$ mabl datatables export <datatable-id> <optional_arguments>
Optional arguments
Option | Details |
---|---|
--format , --fmt | Specify the format for the datatable export: "yaml", "json", or "csv" |
Output
When you run the command, the mabl CLI outputs the name of the exported file, which contains the DataTable scenarios and scenario values.
Examples
# Export a DataTable in json format
$ mabl datatables export <datatable-id> --format json
# Export a DataTable in csv format
$ mabl datatables export <datatable-id> --format csv
Updated 3 months ago