dbt (data build tool) helps transform raw data in Snowflake by writing simple SQL models. It organizes and tests data transformations, making data easier to manage and understand.
Click to reveal answer
beginner
What role does Airflow play when working with dbt and Snowflake?
Airflow schedules and runs dbt jobs automatically. It helps manage workflows by running tasks in order, like refreshing data models in Snowflake at set times.
Click to reveal answer
intermediate
How do you connect dbt to Snowflake?
You configure dbt with Snowflake credentials like account, user, password, warehouse, database, and schema in the dbt profile file. This lets dbt run SQL commands directly on Snowflake.
Click to reveal answer
intermediate
What is a common way to run dbt models in Airflow?
Use Airflow's BashOperator or a custom operator to run dbt commands like 'dbt run' or 'dbt test'. This runs dbt models as part of an automated workflow.
Click to reveal answer
intermediate
Why is it important to test dbt models in an Airflow workflow?
Testing ensures data quality and catches errors early. Running tests in Airflow helps keep data reliable by automatically checking models after they run.
Click to reveal answer
What does dbt primarily do with Snowflake data?
AVisualizes data
BTransforms raw data using SQL models
CSchedules workflows
DStores data in tables
✗ Incorrect
dbt transforms raw data by running SQL models inside Snowflake.
Which tool is best for scheduling dbt jobs automatically?
AAirflow
BSnowflake UI
CExcel
DGitHub
✗ Incorrect
Airflow is designed to schedule and manage workflows like dbt jobs.
What information is NOT needed to connect dbt to Snowflake?
ASnowflake account name
BUser credentials
CWarehouse name
DAirflow DAG ID
✗ Incorrect
Airflow DAG ID is unrelated to dbt's Snowflake connection.
How can Airflow run dbt commands?
ABy writing SQL in Airflow
BDirectly inside Snowflake UI
CUsing BashOperator to run shell commands
DUsing Excel macros
✗ Incorrect
Airflow's BashOperator can run shell commands like 'dbt run'.
Why include dbt tests in Airflow workflows?
ATo improve data quality automatically
BTo slow down the workflow
CTo delete old data
DTo create dashboards
✗ Incorrect
Running tests helps catch data issues early and keeps data reliable.
Explain how dbt and Airflow work together to manage data in Snowflake.
Think about how each tool's role fits in a data pipeline.
You got /3 concepts.
Describe the steps to set up a workflow that runs dbt models on Snowflake using Airflow.
Consider configuration, automation, and testing.
You got /4 concepts.
Practice
(1/5)
1. What is the main role of dbt when integrated with Snowflake?
easy
A. Transforming raw data into clean, modeled tables using SQL
B. Scheduling data pipeline tasks automatically
C. Storing data securely in Snowflake
D. Monitoring Snowflake warehouse usage
Solution
Step 1: Understand dbt's purpose
dbt is designed to transform raw data into clean, modeled tables using SQL scripts.
Step 2: Differentiate from Airflow's role
Airflow handles scheduling and automation, not data transformation itself.
Final Answer:
Transforming raw data into clean, modeled tables using SQL -> Option A
Confusing Airflow's scheduling role with dbt's transformation role
Thinking dbt stores data instead of transforming it
Assuming dbt monitors Snowflake usage
2. Which file in dbt contains the Snowflake connection details for integration?
easy
A. airflow.cfg
B. dbt_project.yml
C. profiles.yml
D. snowflake.sql
Solution
Step 1: Identify dbt configuration files
dbt uses profiles.yml to store connection details like Snowflake credentials.
Step 2: Exclude unrelated files
dbt_project.yml configures project settings, airflow.cfg is for Airflow, and snowflake.sql is not a config file.
Final Answer:
profiles.yml -> Option C
Quick Check:
Connection details = profiles.yml [OK]
Hint: Connection info in dbt is always in profiles.yml [OK]
Common Mistakes:
Confusing dbt_project.yml with profiles.yml
Mixing Airflow config with dbt config
Assuming SQL files hold connection info
3. Given this Airflow DAG snippet to run a dbt command:
dbt_run = BashOperator( task_id='dbt_run', bash_command='dbt run --profiles-dir /home/airflow/.dbt', dag=dag )
What happens when this task runs?
medium
A. Airflow executes dbt models transforming data in Snowflake
B. Airflow creates a new Snowflake warehouse
C. dbt schedules the Airflow DAG
D. Airflow deletes old Snowflake tables
Solution
Step 1: Analyze the BashOperator command
The command dbt run triggers dbt to execute SQL models and transform data in Snowflake.
Step 2: Understand Airflow's role
Airflow runs this command as a task; it does not create warehouses or delete tables itself.
Final Answer:
Airflow executes dbt models transforming data in Snowflake -> Option A
Quick Check:
dbt run = data transformation task [OK]
Hint: dbt run transforms data; Airflow just runs commands [OK]
Common Mistakes:
Thinking Airflow creates or deletes Snowflake resources
Confusing dbt scheduling with Airflow scheduling
Assuming dbt controls Airflow DAGs
4. You configured Airflow to run dbt commands but the tasks fail with authentication errors. What is the most likely cause?
medium
A. Airflow DAG file missing task_id
B. Snowflake warehouse is paused
C. dbt models have syntax errors
D. Incorrect Snowflake credentials in dbt's profiles.yml
Solution
Step 1: Identify cause of authentication errors
Authentication errors usually mean wrong or missing credentials in profiles.yml used by dbt.
Step 2: Exclude other causes
Missing task_id causes Airflow errors but not authentication errors; syntax errors cause runtime failures; paused warehouse causes query delays, not auth errors.
Final Answer:
Incorrect Snowflake credentials in dbt's profiles.yml -> Option D
Quick Check:
Auth error = wrong credentials [OK]
Hint: Check profiles.yml credentials first on auth errors [OK]
Common Mistakes:
Blaming Airflow config instead of dbt credentials
Assuming syntax errors cause authentication failures
Ignoring warehouse state impact
5. You want to automate a data pipeline that runs dbt transformations daily and sends email alerts on failure using Airflow. Which setup best achieves this?
hard
A. Schedule dbt runs in Snowflake and use Airflow only for monitoring
B. Create an Airflow DAG with dbt BashOperator tasks and EmailOperator for alerts
C. Use only dbt Cloud scheduler with no Airflow integration
D. Manually run dbt commands and check logs for errors
Solution
Step 1: Identify automation components
Airflow DAG can schedule dbt commands using BashOperator and send emails on failure with EmailOperator.