Skip to content

fix: chart data preview for dimension-less charts#1356

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/chart-data-preview-dimensions
Open

fix: chart data preview for dimension-less charts#1356
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/chart-data-preview-dimensions

Conversation

@sentry
Copy link
Copy Markdown

@sentry sentry Bot commented May 15, 2026

This PR addresses issue DALGO-BACKEND-1VX, where a ValueError was raised in the /api/charts/chart-data-preview/ endpoint for chart types that do not require dimensions (e.g., 'number' charts).

Root Cause:
The get_chart_data_preview() function in charts_api.py unconditionally called charts_service.get_chart_data_table_preview(). This function, as its name implies, is designed for table charts and explicitly requires at least one dimension. For chart types like 'number' that only display aggregated metrics and have no dimensions, this led to a ValueError when normalize_dimensions() returned an empty list.

Solution:
The implementation now branches the logic within get_chart_data_preview():

  • If payload.chart_type is 'table', it continues to use charts_service.get_chart_data_table_preview().
  • For all other chart types (e.g., 'number', 'bar', 'line'), it now uses charts_service.build_chart_query() and charts_service.execute_chart_query() to fetch the data. This path correctly handles charts without explicit dimensions. The results are then formatted into a DataPreviewResponse compatible structure.

This change ensures that all chart types can be previewed successfully without encountering the ValueError related to missing dimensions.

Fixes DALGO-BACKEND-1VX

@sentry
Copy link
Copy Markdown
Author

sentry Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 27.77778% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.62%. Comparing base (75cb6fd) to head (fe50632).

Files with missing lines Patch % Lines
ddpui/api/charts_api.py 27.77% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1356      +/-   ##
==========================================
- Coverage   58.66%   58.62%   -0.05%     
==========================================
  Files         132      132              
  Lines       15690    15704      +14     
==========================================
+ Hits         9205     9206       +1     
- Misses       6485     6498      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@siddhant3030 siddhant3030 marked this pull request as ready for review May 15, 2026 16:47
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.

0 participants