From 5ded8060db43e7114f31bdd183fc71c3c6fd2fda Mon Sep 17 00:00:00 2001 From: Anand Raman Date: Thu, 30 Jul 2026 10:03:16 -0500 Subject: [PATCH] removed lengthy comment and formatted sql Formatted medallion demo sql and removed a lengthy but unncessary comment. Added .env to gitignore Signed-off-by: Anand Raman --- .gitignore | 1 + .../demos/sql/01-medallion-architecture.sql | 54 ++++++++----------- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 3d7ecc32d44..49701e22ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,4 @@ js-packages/support-bundle-triage/ # Local dev configs .envrc .direnv +.env diff --git a/crates/pipeline-manager/demos/sql/01-medallion-architecture.sql b/crates/pipeline-manager/demos/sql/01-medallion-architecture.sql index 0b403723b70..d423deb5e8a 100644 --- a/crates/pipeline-manager/demos/sql/01-medallion-architecture.sql +++ b/crates/pipeline-manager/demos/sql/01-medallion-architecture.sql @@ -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" } } }]' @@ -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" } } }]' @@ -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" } } }]' @@ -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" } } }]' @@ -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" } } }]' @@ -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" } } }]' @@ -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" } } }]' @@ -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