Skip to content

Commit 4ae3fbb

Browse files
committed
macro to compare tables by row
1 parent 941953f commit 4ae3fbb

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

products/cscl/models/etl_dev_qa/qa__saf_by_row.sql renamed to products/cscl/macros/qa_compare_by_row.sql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
{{ config(
2-
materialized = 'table',
3-
) }}
1+
{% macro compare_by_row(model) -%}
42
WITH dev AS (
5-
SELECT * FROM {{ ref('saf_abcegnpx_generic') }}
3+
SELECT * FROM {{ ref(model) }}
64
),
75
prod AS (
8-
SELECT * FROM {{ source('production_outputs', 'saf_abcegnpx_generic') }}
6+
SELECT * FROM {{ source('production_outputs', model) }}
97
),
108
combined AS (
119
SELECT
@@ -30,4 +28,4 @@ counts AS (
3028
)
3129
SELECT * FROM counts
3230
WHERE dev_count <> prod_count
33-
ORDER BY counts.boroughcode, counts.face_code, counts.segment_seqnum, source
31+
{%- endmacro %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ config(
2+
materialized = 'table',
3+
) }}
4+
{{ qa_compare_by_row('saf_abcegnpx_generic') }}
5+
ORDER BY counts.boroughcode, counts.face_code, counts.segment_seqnum, source
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ config(
2+
materialized = 'table',
3+
) }}
4+
{{ qa_compare_by_row('saf_abcegnpx_roadbed') }}
5+
ORDER BY counts.boroughcode, counts.face_code, counts.segment_seqnum, source
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ config(
2+
materialized = 'table',
3+
) }}
4+
{{ qa_compare_by_row('saf_d_generic') }}
5+
ORDER BY counts.boroughcode, counts.face_code, counts.segment_seqnum, source
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ config(
2+
materialized = 'table',
3+
) }}
4+
{{ qa_compare_by_row('saf_d_roadbed') }}
5+
ORDER BY counts.boroughcode, counts.face_code, counts.segment_seqnum, source

0 commit comments

Comments
 (0)