Making dbt Cloud API calls using the dbt-cloud-cli

There is currently no command line interface for the dbt Cloud API. In order to make calls to the API you’d need write scripts that use tools like cURL or Python requests.

dbt-cloud-cli is a command line interface written in Python that abstracts dbt Cloud API calls behind an easy-to-use interface. All you need to do to get started is to install the package in your Python environment using pip install dbt-cloud-cli and you’re good to go. Want to trigger a dbt Cloud job (e.g., in a CI/CD workflow)? Just run dbt-cloud job run (use the -h flag for usage instructions).

The latest 0.2.0 release implements the following dbt-cloud job and dbt-cloud run commands:

>> dbt-cloud job --help
Usage: dbt-cloud job [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  create  Creates a job in a dbt Cloud project.
  delete  Deletes a job from a dbt Cloud project.
  export  Exports a dbt Cloud job as JSON to a file.
  get     Returns the details of a dbt Cloud job.
  import  Imports a dbt Cloud job from exported JSON.
  run     Triggers a dbt Cloud job run and returns a status JSON response.
>> dbt-cloud run --help
Usage: dbt-cloud run [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  get  Prints a dbt Cloud run status JSON response.

Give the CLI a whirl and let me know what you think :slight_smile: If you have any questions or feedback you can also reach me in GitHub or dbt Slack.

2 Likes