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

[Bug] Include User History Passthrough Columns in iterable__users model #43

Closed
1 of 4 tasks
fivetran-joemarkiewicz opened this issue Jul 10, 2024 · 1 comment · Fixed by #44
Closed
1 of 4 tasks
Assignees
Labels
error:unforced type:bug Something is broken or incorrect

Comments

@fivetran-joemarkiewicz
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

In the documentation we mention that the iterable_user_history_pass_through_columns variable will persist the columns through to the iterable__users end model.

image

However, when inspecting the end model it is clear that we are not persisting these passthrough columns. We should be including the persist_passthrough_columns macro in this cte in order for them to properly pass through to the end model.

), user_with_list_metrics as (
select
user_id,
_fivetran_user_id,
unique_user_key,
email,
first_name,
last_name,
signup_date,
signup_source,
updated_at,
phone_number,
email_list_ids,
count(distinct list_id) as count_lists
from user_unnested
-- roll up to the user
{{ dbt_utils.group_by(n=11) }}

Relevant error log or model output

Defined passthrough columns are not persisting to the designated end model.

Expected behavior

The passthrough columns persist to the end model as defined in the README.

dbt Project configurations

vars:
    iterable__using_campaign_label_history: false
    iterable__using_campaign_suppression_list_history: false
    iterable_user_history_pass_through_columns:
      - name: phone_number_line_type
        alias: phone_digits
      - name: additional_properties

Package versions

Latest

What database are you using dbt with?

bigquery

dbt Version

Latest

Additional Context

I was able to use the following code in my local version of the Iterable package and confirmed the passthrough columns were persisting.

), user_with_list_metrics as (

    select
        user_id,
        _fivetran_user_id,
        unique_user_key,
        email,
        first_name,
        last_name,
        signup_date,
        signup_source,
        updated_at,
        phone_number,
        email_list_ids

        --The below script allows for pass through columns.
        {{ fivetran_utils.persist_pass_through_columns(pass_through_variable='iterable_user_history_pass_through_columns') }}

        , count(distinct list_id) as count_lists

    from user_unnested
    -- roll up to the user
    {{ dbt_utils.group_by(n=13) }} -- WILL NEED TO MAKE DYNAMIC BASED OFF VARIABLE

We can probably achieve the dynamic group by with leveraging similar code as we did here to define the length of the variable and then just add that to the group by argument. So I imagine something like:

{% set passthrough_column_count = iterable_user_history_pass_through_columns | length %}

.... MODEL SQL HERE ....

{{ dbt_utils.group_by(n=11 +passthrough_column_count ) }}

Are you willing to open a PR to help address this issue?

  • Yes.
  • Yes, but I will probably need assistance.
  • No.
@fivetran-joemarkiewicz
Copy link
Contributor Author

Additionally, these passthrough columns are included in other end models within this package. We should ensure the README is updated to highlight which models these passthrough fields will be present in following a successful dbt run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error:unforced type:bug Something is broken or incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants