Skip to main content
waffle.svg
Domo Knowledge Base

Command Line Interface (CLI) Tool

Version 35

 

Intro

Domo's Command Line Interface (CLI) allows you to perform data management functions, such as importing and exporting DataSets, configuring Blends, managing PDP policies, pages, users and groups, and more.

Click here to view the changelog.

Using the CLI Tool

Installing and launching

  1. Navigate to Admin Settings > Tool Downloads then click the "Try the Domo CLI" button

    1. Or download directly by clicking here

  2. Open a terminal application (e.g. Terminal on macOS or PowerShell on Windows)

  3. Run the CLI binary file using Java: java -jar domoUtil.jar

    Tip: If using a Windows machine, place the .jar file into a folder such as C:\domo\java. Then, you can launch the CLI Tool by using the following command line: java -jar C:\domo\java\domoUtil.jar

Available commands

The following commands are currently supported within Domo's CLI Tool:

help Display all command names.
help [command name] Show specific flags and parameters for that particular command. (e.g.help upload-datasetwill show all parameters available and required to run that command.)
abort-upload Remove a data version from the index chain. Use 'get-version' to get a full list of data versions.
add-user-to-group Adds user(s) to a Domo group. Expects comma-separated list of user IDs. Use 'get-group' to get the group ID.
approve-certification Approve a pending certification request.
backup Backup Domo objects to an AWS S3 bucket.
backup-card Export a specified card as a JSON object to a file or stdout that can be used to restore it later.
check-for-updates Check for the latest version.
connect Connect to a Domo Server.
Important: You must execute the connect command for every new session. Otherwise, you will receive an authentication error.
convert-sql Convert a SQL statement to DQL.
copy-group-members Copy members of one group to another.
create-blend Create a Blend.
create-dataset Create a Domo DataSet.
create-dataview Create a view using DQL.
create-dataview-payload Return the payload for creating a view on a specified DataSet.
create-dynamic-pdp Create a dynamic PDP rule.
create-group Create a new group.
create-user Create a Domo user.
data-split Split a CSV file into multiple GZipped parts to prepare for concurrent uploads.
dataflow-run-now Run a DataFlow.
dataset-run-now Start a Domo DataSet import. You will need to run the 'list-dataset' command to retrieve the onboardImportId or streamId.
define-upsert Define DataSet upsert columns.
delete-card Delete a card.
delete-dataset Delete a Domo DataSet.
delete-rows Delete the specified row(s) of data from a Domo DataSet.
Note: This funtion only works on DataSets that have Upsert enabled. The CSV file should contain only the Upsert 'key' columns of the rows you want deleted.
derive-schema Derive the DataSet schema from an input file.
disable-report Disable scheduled report.
disconnect Disconnect the current user from the Domo Server.
download-card-data Download the data powering a card.
enable-blend-pdp Enable PDP on a Blend.
enable-fusion-pdp Enable/disable PDP on a Fusion.
enable-report Enable scheduled report.
export-data Export a DataSet to a CSV file.
export-to-s3 Export a DataSet to CSV files on an AWS S3 bucket.
export-version Export a specific version of a DataSet.
generate-card-image Generate a card as a PNG image.
get-alerts Get a list of alerts. Optional object ID and type will return alerts associated with a specific object.
get-blend Get Blend definition.
get-blend-columns Get a list of columns displayed in a Blend.
get-blend-pdp Get PDP policies associated with a Blend.
get-certifications Get certification templates.
Note: This option ONLY works with 'User Name' authentication.
get-certified-content Get a list of certified content.
Note: This option ONLY works with 'User Name' authentication.
get-dataset Get a DataSet metadata.
get-fusion-columns Return the specified DataFusion column names.
get-fusion-pdp Return the specified PDP policies for a DataFusion.
get-group Return a Domo group by name.
get-needed-approvals Get list of pending approvals.
get-schema Return the specified Domo DataSet schema.
get-trusted-attributes Get a list of trusted attributes.
get-user Return a Domo user by email or ID. You can get a single user or the entire user list. You can also filter by 'mailbox' (@domo.com) or format output for add-user-to-group if needed.
get-version Return the specified Domo DataSet version.
index-dataset Begin indexing process for a given datasource.
list-dataflow List all DataFlows.
list-dataset List all DataSets.
list-page List all pages.
list-report Lists all scheduled reports.
move-data Move data from one Domo DataSet to another.
move-page Move pages in navigation hierarchy.
query-data Query DataSet and write results to a CSV file.
quit Quit the application.
rename-blend-columns Rename columns in a Blend.
rename-card Rename a card.
rename-dataset Rename a DataSet.
rename-fusion-columns Rename DataFusion columns.
request-certification Request a certification on an object.
restore-card Restore a card from a JSON definition.
search-domo Search Domo by entity type and search term. Valid entities include page, card, user, group, and DataSet.
search-replace-bm Find and replace words in a Beast Mode.
set-dataflow-properties Configure DataFlow metadata.
set-dataset-retention-window Create a rolling window of data by defining a retention window.
set-logo Change the company logo.
set-schema Change a DataSet schema.
Note: Changes will be reflected upon next re-index.
subscribe-user-to-alert Subscribe a user to an alert. Use get-alerts to get the alert ID.
swap-owner Change the owner of an object.
test-proxy Test proxy settings.
update-blend Update Blend.
update-connector-settings Update a DataSet connector settings.
update-group Modify a group.
update-user Modify a user.
upload-blobstore Upload CSV data from an Azure Blobstore.
upload-dataset Upload data to a Domo DataSet.
Note: Depending on size, the file will be split up as necessary into multiple parts for uploading. We recommend keeping file sizes under 100MB after compression.
upload-hive Upload data to Domo from a Hadoop Hive query.
upload-jdbc Connect via JDBC to a data source and upload query results.
upload-redshift Upload data to Domo from a AWS Redshift unload query.
upload-s3 Upload data to Domo from an AWS S3 Bucket.
upload-snowflake Unload Snowflake data to AWS S3 and then upload to Domo.
whoami Display the current authenticated user.

Command use cases

Connecting to a Domo instance

To connect to a Domo instance, run theconnectcommand and enter the following parameters:

-p, --password <PASSWORD> Domo login password
-u, --username <USERNAME> Domo login username
-s, --server <SERVERNAME> Domo server
-pp, --proxypassword <proxypassword> Proxy password
-ps, --proxyserver <proxyserver> Proxy server
-pt, --proxyport <proxyport> Proxy port
-pu, --proxyuser <proxyuser> Proxy user
-t, --token <TOKEN> Token
Example

connect -u jim.smith@xyzcompany.com -p abc123 -s xyzcompany.domo.com

connect -s xyzcompany.domo.com -t mffde8e727f825ae23e1117070f0ad67cfeb40c607dddd

Disconnecting from a Domo instance

To disconnect from a Domo instance, run thedisconnectcommand without using any parameters. 

Creating a new DataSet

Follow these steps to create a new DataSet using the CLI Tool.

  1. Create a Domo access token. For more information on how to create and manage access tokens, see Managing Access Tokens

  2. Obtain the schema file in JSON format of the DataSet you want to upload to Domo by running thederive-schemacommand.

    Note: To derive the schema from an existing CSV file, use the following command, replacing ''filename.csv' with your file name. derive-schema -d 'C:\directory\filename.csv' -s 'C:\directory\schemafile.json'
  3. Perform a pre-check on the data by generating a RFC 4180-compliant CSV with a small number of rows. Obtain the schema file and run thecreate-datasetcommand to validate the upload will work. You may then delete that DataSet from Domo at your discretion.

    Tip: You will need to place double quotes (") around any commas in your CSV that you want to escape, otherwise the CLI Tool will use the comma as a delimiter.
  4. If the command is successful, you will be presented with the DataSet ID.

  5. Once the pre-check is successful, run thecreate-datasetcommand using the full file's schema file.

Deleting a DataSet

To delete a DataSet in Domo, use thedelete-datasetcommand, replacing [dataset id] with the ID of the DataSet you want to delete.

delete-dataset -id [dataset id]

You can get a list of DataSet ID's by using thelist-datasetcommand.

Uploading Data to a DataSet

To upload data to a DataSet after it has been created, use theupload-datasetcommand, replacing [dataset id] with the ID of the DataSet you want to update.

Important: By default, when updating a DataSet, the entire existing DataSet will be replaced with the new upload unless you use the append parameter. 

Parameters available for theupload-datasetcommand are:

-a, --append Append to existing data.
-c, --compressed Data file(s) are gzipped.
-d, --dir <DIRECTORY> Data (CSV) directory.
-f, --data <FILENAME> Data (CSV) file.
-h, --headers Data file has a header row.
-i, --id <ID> DataSet ID.
-p, --partition <arg> Partition tag.
-t, --temp-dir <TEMP> Temp path to use.
Examples

upload-dataset -id [dataset id] -data "c:\directory\datafile.csv"

upload-dataset -i <dataset_id> -f <filename>

upload-dataset -i <dataset_id> -f <filename> -a

upload-dataset -i <dataset_id> -f <filename> -a -p <partition_name>

upload-dataset -i <dataset_id> -d <directory_name>


Uploading Data from a Database via JDBC

Ensure the JDBC driver JAR file is in the current working directory.

For example, if your domoUtil.jar is in ~/bin, but you are starting the utility from ~, your driver file needs to be in ~.

Example
upload-jdbc
  --dataset example_jdbc_upload
  --jdbcConnection jdbc:mysql://localhost:3306
  --jar mysql-connector-java-8.0.18.jar
  --query "select * from example;"
  --jdbcUser root
  --jdbcPassword password
  --jdbcDriver com.mysql.cj.jdbc.Driver

Creating a user

Create a user using the CLI Tool by specifying an email, whether or not to send an email invitation, full name, and their access rights role. Currently, you can create users with the following access rights: Admin, Privileged, Editor, Particpant, and Social.

create-user -n 'James Smith' -r Editor -i true -e jim.smith@xyzcompany.com

Query (export) Data

Important: By default, queries return a maximum of one million rows. You can specify a higher limit in your query but you may experience a timeout if the result is too large. For full exports, use the export-data command. 

Thequery-datacommand will export the data from a specified DataSet ID to a CSV file. Either the-qor-qfparameters must be used with this command.

Note: The exported file respects any Personalized Data Permissions (PDP) that are set for the specified DataSet.

The parameters available for this command are:

-i, --id <ID> DataSet ID
-q, --query <QUERY> Query file in JSON format
-qf, --queryfile <QUERYFILE> Query filename
-xf, --exportfile <EXPORTNAME> Export filename
Example
query-data -i [dataset id] -qf [query file in JSON format] -xf [filename]

Generate card image

Thegenerate-card-imagecommand will generate a PNG image of the specified card ID.

generate-card-image -i [card id] -f [file name]

Move a Page

Themove-pagecommand allows you to move a page up in the hierarchy as a top level page or down in the hierarchy to a subpage.

The parameters available for this command are:

-i Page ID of the page you are moving
-p Parent page ID if demoting a page.
Demote a page

move-page -i 1234567 -p 7654321

Promote a page

move-page -i 1234567

Tip: For more information on how to find a page ID, see Locating a Page ID.

Move Data

The move-data command allows you to move data from one existing DataSet to another existing DataSet.

The parameters available for this command are:

-a, --append Append to existing data
-d, --destination <destination> Destination DataSet
-s, --source <source> Source DataSet
Example

move-data -a -s [DataSet ID of where the data will be moved to] -d [DataSet ID of where the data is coming from]

Note: To move data using a replace method, remove the -a parameter from the command line.

Listing DataSets

Thelist-datasetcommand will list all of the DataSets based on owner, a search term, or a specific DataSet ID. 

The parameters available for this command are:

-i, --id <ID> DataSet ID
-n, --name-like <NAME_PATTERN> Name filter
-o, --owner-id <TYPE> DataSet Owner ID
Note: Use 'me' instead of a DataSet Owner ID to use the currently authenticated user.
Example

list-dataset -o me -name-like "sales"

list-dataset -name-like "marketing"

Search Domo

Thesearch-domocommand searches and exports a list from Domo by entity type and search term. 

The parameters available for this command are:

-e, --entities <ENTITIES> Entity type. Valid entities include app, buzz, buzz_channel, connector, dataflow, dataset, dojo_message, feature, knowledge_base, project, task, page, card, user, and group.
-f, --filename <NAME> Filename to export information.
-l, --limit <LIMIT> Result limit.
-o, --offset <OFFSET> Result offset.
-t, --term <TERM> Search term.
Example

search-domo -e "card,dataset" -t "sales"

Who am I?

The whoami command will return the username and user ID of the individual that is currently logged in. There are no parameters for this command.

> whoami

John Smith (userid: 123456789)

Ending a session

To end you CLI session, usequit.

Scripting

While you can type the commands shown above in the command prompt, you can also create a text file with the commands and execute it as a script file.

Example script file (uploadfile.domo)

connect -t [access token id] -s xyzcompany.domo.com
upload-dataset -id [dataset id] -data "c:\directory\datafile.csv" -append
quit

Example script file execution

java -jar domoUtil.jar -script c:\directory\uploadfile.domo

Tip: Be sure to update 'uploadfile.domo' in the above example to your own script file name.