Models Flashcards

(48 cards)

1
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which dbt YAML file does not support Jinja?

A

dependencies.yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In which dbt YAML files can you use vars?

A

Any YAML file that supports Jinja, like schema.yml and snapshots.yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you pass vars to dbt_project.yml, packages.yml, and profiles.yml?

A

Through the CLI using –vars

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why can’t you define vars inside dbt_project.yml, packages.yml, and profiles.yml?

A

These files are parsed before Jinja is rendered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can you use env_var() in YAML files that support Jinja?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which dbt YAML files support secure environment variables with DBT_ENV_SECRET_?

A

profiles.yml and packages.yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which dbt package generates YML and SQL files for models and sources?

A

dbt_codegen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which dbt package provides macros like date_spine for development?

A

dbt_utils

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which package evaluates your dbt project against best practices?

A

dbt_project_evaluator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which package offers additional tests beyond dbt’s built-in ones?

A

dbt_expectations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which package helps compare outputs of two queries for refactoring?

A

dbt_audit_helper

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which package tracks dbt run performance over time?

A

dbt_artifacts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which package ensures your dbt project is tested and documented?

A

dbt_meta_testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a resilient way to select models in dbt?

A

Use folder structure, e.g., dbt build –select marts.marketing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How should you group dbt jobs?

A

By build cadences and SLAs (hourly, daily, weekly)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How can you test a subset of records in dbt?

A

Use the ‘where’ config for tests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How can you examine failing test records in dbt?

A

Use ‘store_failures’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you set acceptable failure thresholds for dbt tests?

A

Use severity thresholds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What config optimizes incremental model behavior?

A

‘incremental_strategy’

21
Q

Where do you set global defaults in dbt?

A

In dbt_project.yml using vars

22
Q

How can you avoid repetition in Jinja code?

A

Use for loops

23
Q

What is a better way to apply grants than post-hooks?

A

Use the grants config

24
Q

How do you prevent reprocessing already transformed data?

A

Set source-freshness thresholds

25
How do you run a model and its upstream dependencies?
Use '+' on the left, e.g., dbt build --select +model_name
26
How do you run a model and its downstream dependencies?
Use '+' on the right, e.g., dbt build --select model_name+
27
How do you run all models in a directory?
Use the directory name, e.g., dbt build --select dir_name
28
What does the '@' operator do in dbt CI setups?
Runs selection’s parents, children, and children’s parents
29
How do you exclude models from a dbt selection?
Use the --exclude flag
30
What flag rebuilds an incremental model completely?
--full-refresh
31
What are dbt seeds used for?
Creating lookup tables from CSVs
32
How can you change logic based on the dbt environment?
Use target.name
33
What is a SQL model in dbt?
A select statement defined in a .sql file.
34
How is the model name determined in dbt?
It is inherited from the filename and must match exactly, including case sensitivity.
35
Why is it recommended to use underscores instead of dots in model names?
To avoid issues with filename conventions and ensure consistency.
36
What happens when you execute `dbt run`?
dbt builds the model in the data warehouse by wrapping it in a `create view as` or `create table as` statement.
37
What is the default materialization for dbt models?
Views.
38
Where are models built by default in dbt?
In a target schema defined by the user.
39
How can you change the materialization of a model in dbt?
By using configurations in `dbt_project.yml` or in the model file using a `config` block.
40
What is the purpose of the `ref` function in dbt models?
To reference other models, create dependencies, and manage execution order through a DAG.
41
How does the `ref` function help with environment management in dbt?
It replaces the referenced model with the appropriate database name based on the target schema, making it environment-aware.
42
What is the benefit of using the `ref` function for modular transformations?
It encourages re-use of models and reduces repeated code.
43
Where can you set configurations for dbt models?
In `dbt_project.yml` or in the model file using a `config` block.
44
What is an example of a model configuration in dbt?
Changing the materialization, setting a schema, or applying tags.
45
How are configurations applied in dbt when there are subdirectories?
Hierarchically, with subdirectory configurations overriding general ones.
46
What is the purpose of the DAG in dbt?
To determine the order in which models are run based on their dependencies.
47
What type of models does dbt support besides SQL models?
Python models (starting from version 1.3).
48
What does a dbt project consist of?
A directory with a `.yml` configuration file and `.sql` or `.py` model files.