Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to specify the dbt Cloud job ID for deployment.
dbt
job_id = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the job ID as a number without quotes.
Using an undefined variable instead of a string.
✗ Incorrect
The job ID must be a string, so it needs to be enclosed in quotes.
2fill in blank
mediumComplete the code to trigger a dbt Cloud job run using the API.
dbt
response = client.run_job(job_id=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the job ID as a string literal instead of variable.
Passing a number directly without variable.
✗ Incorrect
The variable job_id should be passed without quotes to use its value.
3fill in blank
hardFix the error in the code to check if the dbt Cloud job run was successful.
dbt
if response.status_code == [1]: print('Run succeeded')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing status_code to string '200' instead of integer 200.
Using boolean or string literals instead of numeric code.
✗ Incorrect
The status code is an integer, so it should be compared to 200 without quotes.
4fill in blank
hardFill both blanks to create a dictionary with job ID and cause for triggering a run.
dbt
payload = [1]: [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using set notation instead of dictionary for keys.
Using numbers instead of descriptive strings for values.
✗ Incorrect
The dictionary key should be a string 'job_id' and the value a string describing the cause.
5fill in blank
hardFill both blanks to create a dictionary comprehension filtering runs with status 'success'.
dbt
successful_runs = {run: run['id'] [1] run in runs if run['status'] [2] 'success'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '.' instead of ':' in dictionary comprehension.
Using '.get()' instead of direct key access.
Using '=' instead of '==' for comparison.
✗ Incorrect
Use ':' to separate key and value, access run['name'], and check status with '=='.