-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: Use dot notation for revenue views #31016
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
Conversation
Following https://github.com/PostHog/posthog/pull/30947/files let's also make the revenue views use dot notation. This will make them fit slightly better.
if source.prefix is None: | ||
name = f"stripe.revenue_view" | ||
else: | ||
prefix = source.prefix.strip("_") | ||
name = f"stripe.{prefix}.revenue_view" |
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.
It's always stripe for now, so I don't mind hardcoding this, will eventually need to make this a little bit more dynamic
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.
PR Summary
Overall, the PR updates revenue view naming to adopt dot notation consistently across the codebase, affecting data source prefixes, query construction, and view assignment logic.
- Modified
/products/revenue_analytics/backend/models.py
to generate RevenueAnalyticsRevenueView names with dot notation, noting a potential double dot if source.prefix is empty. - Updated
/posthog/hogql/database/database.py
to use the view’s name attribute for revenue view assignment instead of concatenating strings. - Changed
/products/revenue_analytics/backend/hogql_queries/revenue_example_data_warehouse_tables_query_runner.py
to build queries with unqualified field references aligning with dot notation. - Adjusted prefix settings in
/posthog/warehouse/test/utils.py
to remove an underscore suffix.
4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
if source.prefix is None: | ||
name = f"stripe.revenue_view" | ||
else: | ||
prefix = source.prefix.strip("_") | ||
name = f"stripe.{prefix}.revenue_view" |
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.
logic: Empty prefix ("") will lead to 'stripe..revenue_view'. Consider checking for falsy values instead of 'is None'.
if source.prefix is None: | |
name = f"stripe.revenue_view" | |
else: | |
prefix = source.prefix.strip("_") | |
name = f"stripe.{prefix}.revenue_view" | |
if not source.prefix: | |
name = f"stripe.revenue_view" | |
else: | |
prefix = source.prefix.strip("_") | |
name = f"stripe.{prefix}.revenue_view" |
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.
This is needed - prefix can be ""
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.
Ah, nice, fixed it + added some tests
e7dedd7
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.
The greptile comment is legit btw
if source.prefix is None: | ||
name = f"stripe.revenue_view" | ||
else: | ||
prefix = source.prefix.strip("_") | ||
name = f"stripe.{prefix}.revenue_view" |
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.
This is needed - prefix can be ""
Added some tests to prove it works
Following https://github.com/PostHog/posthog/pull/30947/files let's also make the revenue views use dot notation. This will make them fit slightly better.