dbt (data build tool) interview questions

getDbt

6. How do I remove deleted models from my data warehouse?
If you delete a model from your dbt project, dbt does not automatically drop the relation from your schema. This means that you can end up with extra objects in schemas that dbt creates, which can be confusing to other users.

7. If models can only be ‘select’ statements, how do I insert records?
If you wish to use insert statements for perfomance reasons (i.e. to reduce data that is processed), consider incremental models
If you wish to use insert statements since your source data is constantly changing (e.g. to create “Type 2 Slowly Changing Dimensions”), consider snapshotting your source data, and building models on top of your snaphots.

8. What are the four types of materializations built into dbt ?
table
view
incremental
ephemeral

9. What is incremental models in dbt?
Incremental models are built as tables in your data warehouse – the first time a model is run, the table is built by transforming all rows of source data. On subsequent runs, dbt transforms only the rows in your source data that you tell dbt to filter for, inserting them into the table that has already been built (the target table). Incremental models allow dbt to insert or update records into a table since the last time that dbt was run. You can significantly reduce the build time by just transforming new records.Incremental models require extra configuration and are an advanced usage of dbt.


10. What is ephemeral models in dbt ?
ephemeral models are not directly built into the database. Instead, dbt will interpolate the code from this model into dependent models as a common table expression. You can still write reusable logic. Ephemeral models can help keep your data warehouse clean by reducing clutter (also consider splitting your models across multiple schemas by using custom schemas. You cannot select directly from this model.  Overuse of the ephemeral materialization can also make queries harder to debug.

Author: user

Leave a Reply