Home › Interview Questions › Show the model syntax inside a dbt model. Is the S…

Show the model syntax inside a dbt model. Is the SQL syntax to create a view for product?

🟢 Easy Coding Junior level
1Times asked
Jul 2026Last seen
Jul 2026First seen

šŸ’” Model Answer

A dbt model is a single SQL file that lives in the models/ directory. To create a view for the product table, you would write:

sql
-- models/product_view.sql
{{ config(materialized='view') }}

SELECT
  id,
  name,
  price,
  category
FROM {{ source('raw', 'product') }}

The {{ config(materialized='view') }} macro tells dbt to build a view. The {{ source('raw', 'product') }} macro references the raw product table defined in sources.yml. When you run dbt run, dbt will compile this SQL and create a view named product_view in your warehouse.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

šŸŽ¤ Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500