Skip to main content
Version: 0.4.12

helpers.dbt_cloud

run_dbt_cloud_job

@with_config(
spec=DBTCloudConfiguration,
sections=(known_sections.DBT_CLOUD, ),
)
def run_dbt_cloud_job(credentials: DBTCloudConfiguration = dlt.secrets.value,
job_id: Union[int, str, None] = None,
data: Optional[Dict[Any, Any]] = None,
wait_for_outcome: bool = True,
wait_seconds: int = 10) -> Dict[Any, Any]

[view_source]

Trigger a dbt Cloud job run and retrieve its status.

Arguments:

  • credentials DBTCloudConfiguration - Configuration parameters for dbt Cloud. Defaults to dlt.secrets.value.
  • job_id int | str, optional - The ID of the specific job to run. If not provided, it will use the job ID specified in the credentials. Defaults to None.
  • data dict, optional - Additional data to include when triggering the job run. Defaults to None. Fields of data: '{
  • "cause" - "string",
  • "git_sha" - "string",
  • "git_branch" - "string",
  • "azure_pull_request_id" - integer,
  • "github_pull_request_id" - integer,
  • "gitlab_merge_request_id" - integer,
  • "schema_override" - "string",
  • "dbt_version_override" - "string",
  • "threads_override" - integer,
  • "target_name_override" - "string",
  • "generate_docs_override" - boolean,
  • "timeout_seconds_override" - integer,
  • "steps_override" - [ "string" ] }'
  • wait_for_outcome bool, optional - Whether to wait for the job run to complete before returning. Defaults to True.
  • wait_seconds int, optional - The interval (in seconds) between status checks while waiting for completion. Defaults to 10.

Returns:

  • dict - A dictionary containing the status information of the job run.

Raises:

  • InvalidCredentialsException - If account_id or job_id is missing.

get_dbt_cloud_run_status

@with_config(
spec=DBTCloudConfiguration,
sections=(known_sections.DBT_CLOUD, ),
)
def get_dbt_cloud_run_status(
credentials: DBTCloudConfiguration = dlt.secrets.value,
run_id: Union[int, str, None] = None,
wait_for_outcome: bool = True,
wait_seconds: int = 10) -> Dict[Any, Any]

[view_source]

Retrieve the status of a dbt Cloud job run.

Arguments:

  • credentials DBTCloudConfiguration - Configuration parameters for dbt Cloud. Defaults to dlt.secrets.value.
  • run_id int | str, optional - The ID of the specific job run to retrieve status for. If not provided, it will use the run ID specified in the credentials. Defaults to None.
  • wait_for_outcome bool, optional - Whether to wait for the job run to complete before returning. Defaults to True.
  • wait_seconds int, optional - The interval (in seconds) between status checks while waiting for completion. Defaults to 10.

Returns:

  • dict - A dictionary containing the status information of the specified job run.

Raises:

  • InvalidCredentialsException - If account_id or run_id is missing.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.