Skip to content

Commit d5edaef

Browse files
Merge pull request #8 from Ritik574-coder/dbt_branch
Create staging models, source definitions and data profiling documentation
2 parents ccf8fc9 + 6e3df98 commit d5edaef

11 files changed

Lines changed: 302 additions & 1 deletion

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
SELECT
2+
customer_id
3+
,title
4+
,first_name
5+
,last_name
6+
,full_name
7+
,gender
8+
,date_of_birth
9+
,age
10+
,email
11+
,phone
12+
,address
13+
,city
14+
,state
15+
,state_abbr
16+
,state_full
17+
,zip_code
18+
,country
19+
,region
20+
,customer_segment
21+
,loyalty_points
22+
,is_active
23+
,account_created_date
24+
,preferred_channel
25+
,annual_income_usd
26+
,company
27+
FROM {{ source('bronze', 'customers') }};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SELECT
2+
employee_id
3+
,first_name
4+
,last_name
5+
,full_name
6+
,email
7+
,phone
8+
,job_title
9+
,department
10+
,store_id
11+
,store_name
12+
,store_city
13+
,hire_date
14+
,years_employed
15+
,annual_salary_usd
16+
,commission_rate_pct
17+
,is_active
18+
,performance_rating
19+
,manager_id
20+
FROM {{ source('bronze', 'employees') }};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SELECT
2+
snapshot_date
3+
,product_id
4+
,product_name
5+
,sku
6+
,category
7+
,stock_on_hand
8+
,stock_reserved
9+
,stock_available
10+
,reorder_level
11+
,unit_cost
12+
,unit_price
13+
,inventory_value
14+
,warehouse_location
15+
,store_id
16+
FROM {{ source('bronze', 'inventory_snapshots') }} ;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
SELECT
2+
product_id
3+
,sku
4+
,product_name
5+
,brand
6+
,category
7+
,sub_category
8+
,department
9+
,base_price_usd
10+
,cost_price_usd
11+
,gross_margin_pct
12+
,weight_kg
13+
,is_available
14+
,stock_quantity
15+
,reorder_level
16+
,supplier_name
17+
,supplier_country
18+
,warranty_years
19+
,rating_avg
20+
,review_count
21+
,launched_date
22+
,product_url
23+
FROM {{ source('bronze', 'products') }} ;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
SELECT
2+
return_id
3+
,original_txn_id
4+
,original_order_id
5+
,customer_id
6+
,customer_name
7+
,product_id
8+
,product_name
9+
,quantity_returned
10+
,return_date
11+
,return_reason
12+
,refund_amount
13+
,refund_method
14+
,return_channel
15+
,restocked
16+
,return_status
17+
,handled_by_emp_id
18+
,notes
19+
FROM {{ source('bronze', 'returns') }} ;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SELECT
2+
review_id
3+
,txn_id
4+
,customer_id
5+
,customer_name
6+
,product_id
7+
,product_name
8+
,rating
9+
,rating_text
10+
,review_date
11+
,verified_purchase
12+
,helpful_votes
13+
,review_channel
14+
,review_title
15+
FROM {{ source('bronze', 'reviews') }} ;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
SELECT
2+
store_id
3+
,store_name
4+
,store_type
5+
,address
6+
,city
7+
,state
8+
,state_full
9+
,zip_code
10+
,country
11+
,region
12+
,district
13+
,phone
14+
,manager_name
15+
,opened_date
16+
,sq_footage
17+
,num_employees
18+
,annual_rent_usd
19+
,is_active
20+
,has_parking
21+
,has_cafe
22+
FROM {{ source('bronze', 'stores') }} ;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
SELECT
2+
transaction_id
3+
,order_id
4+
,order_line_number
5+
,order_date
6+
,order_year
7+
,order_month
8+
,order_month_name
9+
,order_quarter
10+
,order_day_of_week
11+
,ship_date
12+
,delivery_date
13+
,customer_id
14+
,customer_full_name
15+
,customer_first_name
16+
,customer_last_name
17+
,customer_email
18+
,customer_phone
19+
,customer_city
20+
,customer_state
21+
,customer_zip
22+
,customer_region
23+
,customer_segment
24+
,customer_gender
25+
,customer_age
26+
,customer_age_group
27+
,product_id
28+
,product_name
29+
,sku
30+
,brand
31+
,category
32+
,sub_category
33+
,department
34+
,quantity_ordered
35+
,unit_list_price
36+
,discount_pct
37+
,unit_selling_price
38+
,line_total_before_tax
39+
,tax_rate_pct
40+
,tax_amount
41+
,line_total_with_tax
42+
,store_id
43+
,store_name
44+
,store_city
45+
,store_state
46+
,store_region
47+
,store_type
48+
,employee_id
49+
,employee_name
50+
,employee_job_title
51+
,promo_id
52+
,promo_name
53+
,sales_channel
54+
,payment_method
55+
,shipping_method
56+
,order_status
57+
,is_returned
58+
,cost_price
59+
,gross_profit
60+
,data_source
61+
,record_created_ts
62+
,last_modified_ts
63+
FROM {{ source('bronze', 'sales_transactions') }} ;

models/staging/_retail__models.yml

Whitespace-only changes.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# =============================================================================
2+
# ========================= BRONZE SOURCE DEFINITIONS =========================
3+
# =============================================================================
4+
# Purpose:
5+
# | Defines all raw source tables available in the Bronze layer of the |
6+
# | Retail Data Warehouse. These sources represent the initial landing |
7+
# | zone for data ingested from operational systems and external feeds. |
8+
# Maintainer: Ritik
9+
# =============================================================================
10+
version: 2
11+
12+
sources:
13+
- name: bronze
14+
description: |
15+
Bronze layer contains raw, untransformed data ingested from source systems.
16+
These tables represent the initial landing zone of the Retail Data Warehouse
17+
and serve as the source for all staging models.
18+
19+
database: RetailDB
20+
schema: bronze
21+
22+
tables:
23+
- name: customers
24+
description: |
25+
Raw customer master dataset containing customer demographic, contact,
26+
geographic, account and loyalty information. Data profiling identified
27+
multiple data quality issues including duplicate customer identifiers,
28+
inconsistent categorical values, mixed date formats, malformed email
29+
addresses, non-standard phone number patterns, missing values, incomplete
30+
address information, invalid ZIP codes, inconsistent state and city names,
31+
and varying text formats across several attributes. The dataset represents
32+
source-system data in its original form and may contain operational data
33+
entry errors, formatting inconsistencies and missing business attributes.
34+
35+
- name: employees
36+
description: |
37+
Raw employee master dataset containing employee identity, contact,
38+
organizational, compensation and performance-related information.
39+
Data profiling identified multiple data quality issues including
40+
invalid or duplicate employee identifiers, inconsistent name formats,
41+
leading and trailing whitespace, malformed email addresses, multiple
42+
phone number patterns, missing values, inconsistent categorical values,
43+
mixed hire date formats, invalid numeric values in compensation fields,
44+
incomplete store information and inconsistencies across employee
45+
management and performance attributes. The dataset represents source
46+
system data in its original form and may contain operational data entry
47+
errors, formatting inconsistencies and incomplete business records.
48+
49+
50+
- name: inventory_snapshots
51+
description: |
52+
Raw inventory snapshot data containing product stock levels, pricing,
53+
warehouse locations and store allocation details. Data profiling
54+
identified mixed date formats, invalid product identifiers, category
55+
inconsistencies, missing values and formatting issues across inventory
56+
and pricing attributes.
57+
58+
59+
- name: products
60+
description: |
61+
Raw product master dataset containing product catalog, pricing,
62+
inventory, supplier and product lifecycle information. Data profiling
63+
identified invalid product identifiers, inconsistent text formatting,
64+
missing product attributes, pricing anomalies, mixed date formats,
65+
invalid inventory values and inconsistent supplier information.
66+
67+
- name: returns
68+
description: |
69+
Raw returns data containing customer return and refund transactions.
70+
Profiling revealed identifier quality issues, formatting inconsistencies,
71+
missing values, invalid monetary amounts, mixed date formats and
72+
inconsistent categorical values across return channels, statuses and
73+
operational attributes.
74+
75+
- name: reviews
76+
description: |
77+
Raw review data containing customer feedback records. Profiling revealed
78+
identifier quality issues, inconsistent categorical values, mixed date
79+
formats, invalid ratings, missing references and formatting anomalies
80+
across multiple review attributes.
81+
82+
- name: sales_transactions
83+
description: |
84+
Raw sales transaction data collected from multiple operational systems.
85+
Profiling revealed date format variations, duplicate records, invalid
86+
financial values, inconsistent business categories, missing foreign key
87+
references, formatting anomalies and transactional integrity issues
88+
across the dataset.
89+
90+
- name: stores
91+
description: |
92+
Raw store dataset containing location and operational information.
93+
Profiling revealed identifier quality issues, geographic data
94+
inconsistencies, invalid contact information, mixed date formats,
95+
malformed ZIP codes, missing values and inconsistent categorical
96+
representations across the dataset.

0 commit comments

Comments
 (0)