-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from bruin-data/add-new-template
add new pipeline template
- Loading branch information
Showing
5 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* @bruin | ||
name: product_categories | ||
type: duckdb.sql | ||
materialization: | ||
type: table | ||
columns: | ||
- name: category_id | ||
type: INTEGER | ||
description: "Unique identifier for the product category" | ||
primary_key: true | ||
checks: | ||
- name: not_null | ||
- name: positive | ||
- name: category_name | ||
type: VARCHAR | ||
description: "Name of the product category" | ||
checks: | ||
- name: not_null | ||
- name: description | ||
type: VARCHAR | ||
description: "Description of the product category" | ||
@bruin */ | ||
|
||
SELECT | ||
1 AS category_id, 'Electronics' AS category_name, 'Devices like phones, laptops, and monitors' AS description | ||
UNION ALL | ||
SELECT | ||
2 AS category_id, 'Accessories' AS category_name, 'Complementary items like headphones and chargers' AS description | ||
UNION ALL | ||
SELECT | ||
3 AS category_id, 'Appliances' AS category_name, 'Household devices like refrigerators and microwaves' AS description | ||
UNION ALL | ||
SELECT | ||
4 AS category_id, 'Furniture' AS category_name, 'Home and office furniture like desks and chairs' AS description; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* @bruin | ||
name: product_price_summary | ||
type: duckdb.sql | ||
materialization: | ||
type: table | ||
depends: | ||
- products | ||
columns: | ||
- name: price_range | ||
type: VARCHAR | ||
description: "Range of product prices" | ||
- name: total_stock | ||
type: INTEGER | ||
description: "Total stock available in the price range" | ||
checks: | ||
- name: non_negative | ||
- name: product_count | ||
type: INTEGER | ||
description: "Number of products in the price range" | ||
checks: | ||
- name: non_negative | ||
@bruin */ | ||
|
||
WITH price_buckets AS ( | ||
SELECT | ||
CASE | ||
WHEN price < 200 THEN 'Below $200' | ||
WHEN price BETWEEN 200 AND 500 THEN '$200 - $500' | ||
WHEN price BETWEEN 501 AND 1000 THEN '$501 - $1000' | ||
ELSE 'Above $1000' | ||
END AS price_range, | ||
stock | ||
FROM products | ||
) | ||
|
||
SELECT | ||
price_range, | ||
SUM(stock) AS total_stock, | ||
COUNT(*) AS product_count | ||
FROM price_buckets | ||
GROUP BY price_range | ||
ORDER BY price_range; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* @bruin | ||
name: products | ||
type: duckdb.sql | ||
materialization: | ||
type: table | ||
columns: | ||
- name: product_id | ||
type: INTEGER | ||
description: "Unique identifier for the product" | ||
primary_key: true | ||
- name: product_name | ||
type: VARCHAR | ||
description: "Name of the product" | ||
- name: price | ||
type: FLOAT | ||
description: "Price of the product in USD" | ||
checks: | ||
- name: positive | ||
- name: stock | ||
type: INTEGER | ||
description: "Number of units in stock" | ||
@bruin */ | ||
|
||
SELECT | ||
1 AS product_id, 'Laptop' AS product_name, 999.99 AS price, 10 AS stock | ||
UNION ALL | ||
SELECT | ||
2 AS product_id, 'Smartphone' AS product_name, 699.99 AS price, 50 AS stock | ||
UNION ALL | ||
SELECT | ||
3 AS product_id, 'Headphones' AS product_name, 199.99 AS price, 100 AS stock | ||
UNION ALL | ||
SELECT | ||
4 AS product_id, 'Monitor' AS product_name, 299.99 AS price, 25 AS stock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* @bruin | ||
name: shipping_providers | ||
type: duckdb.sql | ||
materialization: | ||
type: table | ||
columns: | ||
- name: provider_id | ||
type: INTEGER | ||
description: "Unique identifier for each shipping provider" | ||
primary_key: true | ||
- name: provider_name | ||
type: VARCHAR | ||
description: "Name of the fictional shipping provider" | ||
- name: delivery_speed | ||
type: VARCHAR | ||
description: "Average delivery time (e.g., '2-day', 'Standard')" | ||
- name: service_areas | ||
type: VARCHAR | ||
description: "Regions or countries where the provider operates" | ||
@bruin */ | ||
|
||
SELECT | ||
1 AS provider_id, 'SwiftCourier' AS provider_name, '2-day' AS delivery_speed, 'North America, Asia' AS service_areas | ||
UNION ALL | ||
SELECT | ||
2 AS provider_id, 'GlobalFreight' AS provider_name, 'Standard' AS delivery_speed, 'Worldwide' AS service_areas | ||
UNION ALL | ||
SELECT | ||
3 AS provider_id, 'BudgetShip' AS provider_name, 'Economy' AS delivery_speed, 'Europe, Africa' AS service_areas | ||
UNION ALL | ||
SELECT | ||
4 AS provider_id, 'ApexLogistics' AS provider_name, 'Overnight' AS delivery_speed, 'North America' AS service_areas; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: duckdb-example-pipeline |