dbt (data build tool) interview questions

1. What is a model in dbt (data build tool)?
A model is a select statement. Models are defined in .sql files (typically in your models directory):
Each .sql file contains one model / select statement
The name of the file is used as the model name
Models can be nested in subdirectories within the models directory
When you execute the dbt run command, dbt will build this model in your data warehouse by wrapping it in a create view as or create table as statement.

2. What are the configurations in a model?
Configurations are “model settings” that can be set in your dbt_project.yml file, and in your model file using a config block. Some example configurations include:
Change the materialization that a model uses – a materialization determines the SQL that dbt uses to create the model in your warehouse.

3. Can I store my models in a directory other than the `models` directory in my project?
By default, dbt expects your seed files to be located in the models subdirectory of your project.
To change this, update the source-paths configuration in your dbt_project.yml file, like so:
source-paths: [“transformations”]

4. Can I split my models across multiple schemas?
Yes. Use the schema configuration in your dbt_project.yml file, or using a config block:
name: jaffle_shop

schema: marketing #

5. Do model names need to be unique?
Yes! To build dependencies between models, you need to use the ref function. The ref function only takes one argument — the model name (i.e. the filename). As a result, these model names need to be unique, even if they are in distinct folders.

Author: user

Leave a Reply

Your email address will not be published. Required fields are marked *