0
0
dbtdata~15 mins

Naming conventions at scale in dbt - Mini Project: Build & Apply

Choose your learning style9 modes available
Naming conventions at scale
📖 Scenario: You work in a company where many data tables are created daily. To keep things clear and easy to find, you need to follow a naming rule for these tables.Imagine you have a list of raw data table names, and you want to create new names for cleaned tables by adding a prefix and suffix.
🎯 Goal: You will create a dictionary of raw table names, set a prefix and suffix, then generate new cleaned table names using these rules.
📋 What You'll Learn
Create a dictionary called raw_tables with exact keys and values
Create two variables called prefix and suffix with exact string values
Use a dictionary comprehension to create a new dictionary called cleaned_tables with new names
Print the cleaned_tables dictionary
💡 Why This Matters
🌍 Real World
In companies, consistent naming helps teams find and understand data tables quickly, especially when many tables exist.
💼 Career
Data engineers and analysts often apply naming conventions to keep data organized and maintainable at scale.
Progress0 / 4 steps
1
Create the raw tables dictionary
Create a dictionary called raw_tables with these exact entries: 'sales': 'sales_data', 'customers': 'customer_info', 'products': 'product_list'.
dbt
Need a hint?

Use curly braces {} to create a dictionary with keys and values separated by colons.

2
Set prefix and suffix variables
Create a variable called prefix and set it to the string 'cleaned_'. Then create a variable called suffix and set it to the string '_v1'.
dbt
Need a hint?

Use simple assignment with = to set string values.

3
Create cleaned table names with dictionary comprehension
Use a dictionary comprehension to create a new dictionary called cleaned_tables. For each key and value in raw_tables.items(), the new value should be the prefix plus the original value plus the suffix.
dbt
Need a hint?

Use {key: value for key, value in dict.items()} format for dictionary comprehension.

4
Print the cleaned tables dictionary
Write a print statement to display the cleaned_tables dictionary.
dbt
Need a hint?

Use print(cleaned_tables) to show the dictionary.