Closed TannerHopkins closed 1 year ago
Is it possible that you haven't rebuilt your data with the --full-refresh
flag on since you fixed the issue in #181 ?
Alternately, the install instructions need updating. The latest version is 3.2.1, but this is what we have in our docs right now:
packages:
- package: Velir/ga4
version: [">=3.0.0", "<3.2.0"]
I'll make a PR for this issue. Please let us know if this is not the source of your problem.
@TannerHopkins are you using user_ids in your project? If a user_id spanned multiple streams then the uniqueness check running on user_id_or_client_key
would fail.
The uniqueness test should be on user_id_or_client_key || stream_id
I'll update that now. Try checking out this branch: https://github.com/Velir/dbt-ga4/pull/195 and let me know the results?
Sorry for the delay here - so I switched the package revision to point to that branch and it still doesn't work 🤔 I ran a dbt clean then a dbt deps & I see the new test:
However, the test fails and when I look at the compiled code it's seemingly still the old test:
What does your compiled code look like @adamribaudo-velir ?
I think this is my bad. I need to move the test under the models
key, not columns
https://docs.getdbt.com/reference/resource-properties/tests#testing-an-expression
We're seeing the
unique_fct_ga4__user_ids_user_id_or_client_key
test fail. It's only happening for oneclient_key
, but thatclient_key
has 3 differentstream_id
values.Perhaps this was an unintended effect of swapping out
user_pseudo_id
forclient_key
in this PR? Maybe there could only be oneuser_pseudo_id
perstream_id
before, but now there can be multiple?Regardless, I did find it interesting that it is grouping by
user_id_or_client_key
andstream_id
infct_ga4__user_ids
, but then testing for uniqueness onuser_id_or_client_key
by itself:I'm not sure if the fix would be to update the uniqueness test to take into account
stream_id
as well, or possible stop grouping bystream_id
and instead take the min/max, similar to what is being done withmax(is_user_id) as is_user_id
above.