fix(dbt): apply safe_numeric macro to fix EES suppression code 'c' errors
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 33s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m14s
Build and Push Docker Images / Build Integrator (push) Successful in 58s
Build and Push Docker Images / Build Kestra Init (push) Successful in 31s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 1m25s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 33s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m14s
Build and Push Docker Images / Build Integrator (push) Successful in 58s
Build and Push Docker Images / Build Kestra Init (push) Successful in 31s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 1m25s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
Replace nullif(col, 'z') casts with safe_numeric macro across KS2, KS4, and admissions staging models. The regex-based macro treats any non-numeric string (z, c, x, q, u, etc.) as NULL without needing an explicit list. Also fix FSM_eligible_percent column quoting in stg_ees_admissions — target- postgres stores mixed-case column names quoted, so unquoted references were being folded to fsm_eligible_percent by PostgreSQL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
9
pipeline/transform/macros/safe_numeric.sql
Normal file
9
pipeline/transform/macros/safe_numeric.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
{#
|
||||
safe_numeric(col)
|
||||
Casts a string column to numeric, treating any non-numeric value as NULL.
|
||||
Handles all EES suppression codes (z, c, x, q, u, etc.) without needing
|
||||
an explicit list — any string that doesn't look like a number becomes NULL.
|
||||
#}
|
||||
{% macro safe_numeric(col) -%}
|
||||
CASE WHEN {{ col }} ~ '^-?[0-9]+(\.[0-9]+)?$' THEN {{ col }}::numeric ELSE NULL END
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user