Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for problem with new BQ loader with shorter col names #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions macros/normalize_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ where


{% macro bigquery__normalize_events(event_names, flat_cols = [], sde_cols = [], sde_keys = [], sde_types = [], sde_aliases = [], context_cols = [], context_keys = [], context_types = [], context_aliases = [], remove_new_event_check = false) %}
{# Remove down to major version for bigquery combine columns macro, drop 2 last _X values #}
{# For old version of BQ loader: Remove down to major version for bigquery combine columns macro, drop 2 last _X values. Otherwise keep it as is #}
{%- set sde_cols_clean = [] -%}
{%- for ind in range(sde_cols|length) -%}
{% do sde_cols_clean.append('_'.join(sde_cols[ind].split('_')[:-2])) -%}
{% if sde_cols[ind].split('_')[-2].isnumeric() and sde_cols[ind].split('_')[-1].isnumeric() %}
{% do sde_cols_clean.append('_'.join(sde_cols[ind].split('_')[:-2])) %}
{% else %}
{% do sde_cols_clean.append(sde_cols[ind]) %}
{% endif %}
{%- endfor -%}
{%- set context_cols_clean = [] -%}
{%- for ind in range(context_cols|length) -%}
Expand Down