Configuration

Here are the following keyword arguments that can be used for configuration:

Keyword argumentDescriptionSample value
account_iddbt Cloud account ID12345
api_tokenService account tokensabc123

Example code

Trigger job run with job_id.

from mage_ai.services.dbt.dbt import DbtCloudClient


client = DbtCloudClient(dict(account_id=12345, api_token='abcdefg'))

# Set poll_status=True to wait for job completion.
# Set poll_status=False to not wait for job completion.
client.trigger_job_run(12345, poll_status=True)

Sample output:

Polling dbt Cloud run 12345. Current status: Starting.
Polling dbt Cloud run 12345. Current status: Running.
Polling dbt Cloud run 12345. Current status: Success.
Job run status for run 12345: Success. Polling complete

Methods

Common APIs in dbt Cloud implemented in the DbtCloudClient.

  1. get_run
  2. list_jobs
  3. list_runs
  4. trigger_job_run