Skip to content

Commit

Permalink
snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-jamie committed May 3, 2023
1 parent a4f47e8 commit e2219ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

## Under the Hood
- Adds a `coalesce` to `previous_email_ids` in the `int_iterable__list_user_history` model, in case there are no previous email ids.
- Adjusts the `flatten` logic in `int_iterable__list_user_unnest` for Snowflake users.

# dbt_iterable v0.6.0

Expand Down
14 changes: 11 additions & 3 deletions integration_tests/seeds/user_history_data.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
email,updated_at,first_name,last_name,phone_number,user_id,signup_date,signup_source,phone_number_carrier,phone_number_country_code_iso,phone_number_line_type,phone_number_updated_at,_fivetran_synced,email_list_ids
[email protected],2021-06-03 08:18:30.000,,,,,2021-06-03 08:14:55.000,Import,,,,,2021-06-03 09:18:13.877,"[826724,884398]"
[email protected],2021-06-03 08:32:01.000,,,,,2021-06-03 08:32:01.000,API,,,,,2021-06-03 09:18:13.708,"[]"
email,updated_at,_fivetran_synced,email_list_ids,first_name,last_name,phone_number,phone_number_carrier,phone_number_country_code_iso,phone_number_details,phone_number_line_type,phone_number_updated_at,signup_date,signup_source,user_id
[email protected],2018-09-14 08:29:13,2021-03-29 17:14:01,[162418],,,,,,,,,2018-09-14 08:29:13,Import,
[email protected],2018-09-18 17:24:11,2021-03-29 17:14:01,[163833],,,,,,,,,2018-09-18 17:22:15,API,
[email protected],2018-09-19 10:06:24,2021-03-29 17:14:01,[164228],,,,,,,,,2018-09-19 10:06:24,Import,22222
[email protected],2018-10-05 05:37:24,2021-03-29 17:14:01,"[159258,159261,162418]",person4,,,,,,,,2018-09-06 10:18:17,Import,string
[email protected],2018-10-05 05:46:47,2021-03-29 17:14:01,"[159246,159258,159261,162418,163833,173413]",person5,five,,ZZZ,0,,Phone,,2018-09-06 9:11:43,Import,1111
[email protected],2018-10-06 11:36:18,2021-03-29 17:14:01,[173950],,,,,,,,,2018-10-06 11:36:18,Import,
[email protected],2021-04-20 20:31:29,2021-04-20 20:56:40,[953900],,,,,,,,,2021-04-20 20:31:30,Import,
[email protected],2021-04-20 20:43:37,2021-04-20 20:56:40,[953900],,,,,,,,,2021-04-20 20:30:16,Import,
[email protected],2021-04-21 20:21:29,2021-04-21 20:28:04,[],,,,,,,,,2021-04-21 20:21:29,API,person_test
[email protected],2021-04-21 20:59:40,2021-04-21 21:01:52,[953900],,,,,,,,,2021-04-20 20:30:16,Import,
2 changes: 1 addition & 1 deletion models/intermediate/int_iterable__list_user_unnest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ with user_history as (

{% if target.type == 'snowflake' %}
cross join
table(flatten(cast(email_list_ids as VARIANT))) as email_list_id
table(flatten(input => parse_json(email_list_ids))) as email_list_id
{% elif target.type == 'bigquery' %}
cross join
unnest(JSON_EXTRACT_STRING_ARRAY(email_list_ids)) as email_list_id
Expand Down

0 comments on commit e2219ca

Please sign in to comment.