To start a dbt run from the dbt-cloud CLI (Command Line Interface), you will first need to have access to a dbt Cloud account and have the dbt-cloud CLI installed on your local machine.
Here are the steps to start a dbt run from the dbt-cloud CLI:
- Open a terminal or command prompt on your local machine.
- Log in to your dbt Cloud account using the
dbt cloud login
command. This will prompt you to enter your email and password associated with your dbt Cloud account. - Select the dbt Cloud project you want to run the dbt command on by using the
dbt cloud use
command followed by the project name. - Navigate to the directory where your dbt project is located on your local machine.
- Use the
dbt run
command to start the dbt run. For example, to run all the models in your dbt project, you can use the commanddbt run
- Optionally you can use
--target
flag to specify a target in your dbt_project.yml file you wish to run the dbt command on. - Optionally you can use
--models
flag to specify the specific models you wish to run the dbt command on. - The dbt-cloud will now connect to the specified target and start running the dbt command on the specified models.
- Once the dbt run is complete, you can use the
dbt cloud runs show
command to view the run details such as the status and log output.
For example if you want to run all models on the target prod
you can use the command dbt run --target prod
or if you want to run only specific models you can use dbt run --models model1,model2
It’s important to note that dbt runs in dbt-cloud are executed in an isolated environment, all state is discarded at the end of the run, and the run logs will be stored in the dbt Cloud for future reference.
Get more useful articles on dbt