Recall & Review
beginner
What does the
surrogate_key macro in dbt-utils do?The
surrogate_key macro creates a unique key by combining one or more columns. It helps identify each row uniquely, like a fingerprint for data records.Click to reveal answer
beginner
How does the
pivot macro in dbt-utils transform data?The
pivot macro turns rows into columns. It reshapes data so that unique values from one column become new columns, making data easier to compare side by side.Click to reveal answer
beginner
What is the purpose of the
unpivot macro in dbt-utils?The
unpivot macro does the opposite of pivot. It turns columns back into rows, which helps when you want to analyze data in a long, tidy format.Click to reveal answer
intermediate
Why is using a surrogate key useful in data modeling?
Surrogate keys provide a simple, consistent way to identify rows uniquely, even if natural keys change or are missing. This helps keep data clean and relationships clear.
Click to reveal answer
intermediate
When would you use
pivot and unpivot in your data transformations?Use
pivot to create wide tables for easier comparison across categories. Use unpivot to create long tables for easier filtering and aggregation.Click to reveal answer
What does the
surrogate_key macro generate in dbt-utils?✗ Incorrect
The
surrogate_key macro creates a unique key by combining specified columns.Which macro would you use to turn multiple rows into columns?
✗ Incorrect
The
pivot macro reshapes data by turning rows into columns.What is the main use of the
unpivot macro?✗ Incorrect
The
unpivot macro converts columns back into rows.Why might surrogate keys be preferred over natural keys?
✗ Incorrect
Surrogate keys provide stable, unique identifiers even if natural keys change.
If you want to analyze data by categories side by side, which macro helps?
✗ Incorrect
The
pivot macro creates columns for each category to compare data easily.Explain how the
surrogate_key macro works and why it is useful in data modeling.Think about how you give each row a unique ID.
You got /3 concepts.
Describe the difference between
pivot and unpivot macros and when to use each.Consider how you reshape data for different analysis needs.
You got /3 concepts.