-
Notifications
You must be signed in to change notification settings - Fork 145
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
Fix invalid generated column names in conversion events #327
Fix invalid generated column names in conversion events #327
Conversation
Great! Lmk if you need help finalizing the tests. Eventually we'll refactor to use dbt's newly released unit test functionality. |
# Update project name to ga4 so we can call macros with ga4.macro_name | ||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return { | ||
"name": "ga4" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought adding this element like in the other tests on models using macros was going to fix the issue but it doesn't.
Lmk if you need help finalizing the tests
I'd be happy to have your help, @adamribaudo-velir
@jerome-laurent-pro check out the latest commit. You just needed to add the macro to unit tests that call the macro. The tests still fail, but for a valid reason: What value is a user expected to enter into the
Notice that the |
Thank you!
The idea was to use the official event_name from GA4 as it'll be named like this in the raw data. Users shouldn't have to guess the future safe name while entering the variable in the project's yaml. The modification you did in the test was creating an error, because the safe column name for In the other test, it seems that the
Adding it again fix the error. It seems like conftest isn't really working as I expected, otherwise I assume we wouldn't have had to do a project_config_update in each test. @adamribaudo-velir, let me know if you think the way I implemented the functionality doesn't make sense or if you want me to add anything else. |
Ah! Thanks, I think I misunderstood the change a bit. And sorry for inadvertently breaking the test while I fixed it 😓 Let me run through an example on my end, but I expect to merge this by end of week. |
Description & motivation
I encountered an issue with non standard event names that I wanted to use as conversion events.
Stuff like
50%_completion
orcondition-click
.I can't change their names in GA4, so I opened this PR to propose a way to create clean column names when they are used to generate conversion events related models.
Currently, using the
conversion_events
variable with these events will result in errors as columns named likecount_condition-click
will be generated.I found this issue that was related (#211)
Checklist
dbt test
andpython -m pytest .
to validate existing tests