Writing a model in Python instead of SQL
dbt supports Python models as an alternative to SQL for transformations that are easier to express in Python, such as complex statistical logic or use of ML libraries. Python models are defined in .py files and must return a DataFrame, but they run on the data platform's compute (not dbt's), so they only work with adapters that support this feature (Snowflake, Databricks, BigQuery).
Must-know
- A Python model must define a function named model(dbt, session) that returns a DataFrame (pandas, Spark, or Snowpark, depending on platform).
- Use dbt.ref() and dbt.source() inside the Python model function to reference other models and sources, just as you would with Jinja in SQL models.
- Python models support the same node configs as SQL models (materialized, tags, schema, etc.), typically set via dbt.config() calls inside the model function or in a .yml/config block.
- Only table and incremental materializations are supported for Python models; view and ephemeral materializations are not supported.
- Python models are only supported on Snowflake, Databricks, and BigQuery (via Dataproc); other adapters like Postgres/Redshift do not support them.
- Because Python models execute as separate jobs on the warehouse's compute (e.g., Snowpark, PySpark), they can be slower to run and iterate on than SQL models, so SQL should still be preferred for simple transformations.
You create a new file at models/customer_scores.py and want dbt to build it as a model. Which function signature must the file define so that dbt run can execute it?
What you have tried across dbt Analytics Engineering's objectives, not a readiness score.
Developing and optimizing dbt models
- Tracing and confirming a model's upstream raw sources
- How dbt's core materialization types differ
- Keeping models modular and avoiding repeated logic
- What each core dbt command actually does
- Shaping a model's dependency graph so it stays readable
- Setting project-wide configuration in dbt_project.yml
- Pulling in and using a dbt package
- Writing a model in Python instead of SQL
- Granting model access through the grants config
- Configuring a snapshot to track slowly changing data
- Picking the right incremental strategy for a dataset
- Dry-running a model to check its logic and schema before a real build
- Sampling a model run before a full build
- What microbatch and other advanced materializations are for
Managing dbt models governance
Debugging data modeling errors
Troubleshooting and optimizing dbt pipelines
Implementing dbt tests
Implementing and maintaining external dependencies
Coverage checked against the published exam guide on Aug 5, 2026.
These are independent practice questions, written against this certification's published exam guide. They are not the certification vendor's own questions, and not the real exam.