-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
test(insights): Run all tests with filters
-based insights using HogQL
#21861
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
1cac259
to
dd58b80
Compare
9ce7475
to
f09821a
Compare
1d83564
to
50a471f
Compare
@@ -326,7 +326,6 @@ def create(self, validated_data: dict, *args: Any, **kwargs: Any) -> Insight: | |||
raise serializers.ValidationError("Dashboard not found") | |||
|
|||
DashboardTile.objects.create(insight=insight, dashboard=dashboard, last_refresh=now()) | |||
insight.last_refresh = now() # set last refresh if the insight is on at least one dashboard |
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 has not been used in a long time and not sure it ever actually worked. The actual last_refresh
is in InsightCachingState at the insight level, and in the cached result packages themselves
if isinstance(cache_key, str) and isinstance(last_refresh, str): | ||
update_cached_state( # Updating the relevant InsightCachingState | ||
insight.team_id, | ||
cache_key, | ||
last_refresh, | ||
result=None, # Not caching the result here, since in HogQL this is the query runner's responsibility | ||
) |
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 only behavioral change in this PR: TestDashboard::test_refresh_cache
revealed we weren't updating InsightCachingState
in here. This change brings us fully back on track with tracking which insights need a background refresh
filters
-based insights using HogQL
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.
Changes look good. 👍 to merge this in once tests pass
This will allow us to catch problems in the saved insights/dashboards layer, and later on when converting /insight/{trend,funnel,etc}.
I don't think we ever want to convert these, since they are replaced by /query
, right?
As for
What do you think @thmsobrmlr? Let me know if you have an idea to refine this |
…QL (#21861) * ci: Run core backend tests with both HogQL and legacy insights * Double the number of tests * Fix env var setting * Add some HOGQL_INSIGHTS_OVERRIDE overrides in tests * Mark `Insight.last_refresh` as deprecated * Fix bad merge * Update query snapshots * Update query snapshots * Update test_team.py * Actually remove legacy backend from matrix * Update test_fetch_from_cache.py * Use `update_cached_state` in `calculate_for_query_based_insight()` * Clean up CI changes and a comment * Fix `update_cached_state` typing * Update test_fetch_from_cache.py * Update test_insight_cache.py * Update test_insight_cache.py * Clarify `generate_insight_cache_key` as legacy function --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
…QL (#21861) * ci: Run core backend tests with both HogQL and legacy insights * Double the number of tests * Fix env var setting * Add some HOGQL_INSIGHTS_OVERRIDE overrides in tests * Mark `Insight.last_refresh` as deprecated * Fix bad merge * Update query snapshots * Update query snapshots * Update test_team.py * Actually remove legacy backend from matrix * Update test_fetch_from_cache.py * Use `update_cached_state` in `calculate_for_query_based_insight()` * Clean up CI changes and a comment * Fix `update_cached_state` typing * Update test_fetch_from_cache.py * Update test_insight_cache.py * Update test_insight_cache.py * Clarify `generate_insight_cache_key` as legacy function --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Changes
Let's make the HogQL engine the default. Still leaving a strategy with the legacy engine running.
This will allow us to catch problems in the saved insights/dashboards layer, and later on when converting
/insight/{trend,funnel,etc}
.