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(Jinja metric macro): Support Drill By and Excel/CSV download without a dataset ID #30443

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vitor-Avila
Copy link
Contributor

SUMMARY

The Jinja {{metric()}} macro allows you to retrieve the corresponding SQL for a metric by using its key, and optionally the dataset ID. When the dataset ID is not specified, it should be automatically retrieved from the context (based on the current dataset).

This PR improves the logic to retrieve this value from other places:

  • It was not possible to use the Drill By option in a chart that had this macro without the dataset ID
  • It was not possible to export a chart using this macro without a specified dataset ID to Excel/CSV

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Drill By

BEFORE
image

AFTER
image

CSV/Excel Export

BEFORE
image

AFTER
User prompted to download the file

TESTING INSTRUCTIONS

Tests updated accordingly. For manual testing:

  1. Create a Pie Chart using this macro and a dimension.
  2. Save it to a dashboard.
  3. Access the dashboard and Drill By on a dimension with any other column.
  4. Then try exporting the chart to Excel.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added dashboard:drill-by dashboard:export Related to exporting dashboards global:jinja Related to Jinja templating labels Sep 30, 2024
@adamcunnington-mlg
Copy link

Thanks for fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:drill-by dashboard:export Related to exporting dashboards global:jinja Related to Jinja templating size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants