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

fix(insight-variables): Fixed insight variables erroring #29295

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

Gilbert09
Copy link
Member

Problem

  • Insights with dashboard variables overrides were erroring due to how we were accessing the variable - we were expecting it to be a dict when it was actually a HogQLVariable
  • Introduced by some query awaited stuff and changing how we parse the variables
  • Reported in slack here

Changes

  • Assume the variable is a HogQLVariable and ensure we return HogQLVariable types
  • Added a test for this

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Added a test

@Gilbert09 Gilbert09 requested review from timgl and a team February 27, 2025 11:49
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Fixed an issue where insights with dashboard variable overrides were erroring due to a type mismatch between expected dictionary format and actual HogQLVariable objects.

  • Modified /posthog/hogql_queries/apply_dashboard_filters.py to properly handle HogQLVariable types in dashboard variable overrides
  • Added proper type annotation for variables_overrides parameter in apply_dashboard_variables functions
  • Changed variable access pattern from dictionary-style to property access for code_name attribute
  • Added test case in /posthog/api/test/test_query.py to verify the fix works correctly with variable overrides

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@Gilbert09 Gilbert09 enabled auto-merge (squash) February 28, 2025 08:55
Copy link
Contributor

@tomasfarias tomasfarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Gilbert09 Gilbert09 merged commit 93320ba into master Feb 28, 2025
90 checks passed
@Gilbert09 Gilbert09 deleted the tom/fix-dashboard-variable branch February 28, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants