Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ js-packages/support-bundle-triage/
# Local dev configs
.envrc
.direnv
.env
54 changes: 21 additions & 33 deletions crates/pipeline-manager/demos/sql/01-medallion-architecture.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ CREATE TABLE bronze_clickstream_events (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_clickstream_events",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -122,9 +122,9 @@ CREATE TABLE bronze_orders (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_orders",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -147,9 +147,9 @@ CREATE TABLE bronze_order_items (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_order_items",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -176,9 +176,9 @@ CREATE TABLE bronze_products (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_products",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -201,9 +201,9 @@ CREATE TABLE bronze_inventory_events (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_inventory_events",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -226,9 +226,9 @@ CREATE TABLE bronze_customers (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_customers",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand All @@ -249,9 +249,9 @@ CREATE TABLE bronze_suppliers (
"config": {
"uri": "s3://feldera-demos/ecommerce-cdc-0-01/snapshot/bronze_suppliers",
"mode": "snapshot",
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
"aws_skip_signature": "true",
"aws_region": "us-west-1",
"transaction_mode": "catchup"
}
}
}]'
Expand Down Expand Up @@ -678,18 +678,6 @@ FROM
SELECT
product_id,
SUM(quantity) AS units_sold,
-- avg_daily_units must be a genuine per-day rate. SUM(quantity) spans
-- the entire history of silver_confirmed_order_items (there is no date
-- filter), so dividing by a hard-coded 30 is only correct when the data
-- happens to hold exactly 30 days of orders: with 90 days it overstates
-- the rate 3x, with 10 days it understates it 3x, which miscalibrates
-- the CRITICAL / WARNING / OK scoring below against a fictitious
-- denominator. Dividing by the number of distinct days actually observed
-- yields a correct rate regardless of the dataset's span or age.
-- (The alternative -- WHERE order_created_at > NOW() - INTERVAL '30' DAY,
-- then divide by 30 -- is avoided here because the demo loads a historical
-- snapshot whose orders may all predate a 30-day window, which would leave
-- this view, and the alerts derived from it, empty.)
CAST(SUM(quantity) AS DECIMAL(38, 6)) / NULLIF(
COUNT(DISTINCT DATE_TRUNC(order_created_at, DAY)),
0
Expand Down
Loading