Skip to content

[ENHANCEMENT] Improve table migration: handle column overrides and fix Value column naming#654

Merged
Nexucis merged 1 commit into
mainfrom
ibakshay/table-migration-enhancement
May 19, 2026
Merged

[ENHANCEMENT] Improve table migration: handle column overrides and fix Value column naming#654
Nexucis merged 1 commit into
mainfrom
ibakshay/table-migration-enhancement

Conversation

@ibakshay
Copy link
Copy Markdown
Contributor

@ibakshay ibakshay commented May 13, 2026

Description

Improves the Grafana-to-Perses table migration CUE script to handle previously-unsupported field override properties and fixes the Value #Xvalue #N column naming mismatch.

Fixes perses/perses#4063

Problem

When migrating a Grafana table panel with multiple queries and column overrides, several issues occurred:

  1. Column naming mismatch — Grafana names multi-query value columns by refId (Value #A, Value #B), but Perses uses 1-based query index (value #1, value #2). The migrated column settings didn't match actual rendered column names, making them ineffective.
  2. Missing column overrides — Grafana field overrides for unit, mappings, and noValue were completely ignored during migration, resulting in:
    • No unit formatting on columns (e.g., percent)
    • No value mappings (e.g., 0"False", 1"True")
    • No fallback text for null values

Changes

1. Fix Value column naming (refId → index)

Builds a mapping from the targets array to convert Grafana's refId-based naming to Perses's index-based naming automatically:

  • Value #Avalue #1 (first query)
  • Value #Bvalue #2 (second query)
  • ....

2. Handle unit override → per-column format

Grafana field overrides with "id": "unit" are now converted to format: {unit: "..."} on the corresponding column setting. Only units recognized by Perses are emitted (e.g., percent, bytes, seconds). Unrecognized Grafana-specific units (e.g., decgbytes, dectbytes) are skipped.

3. Handle mappings override → per-column cellSettings

Grafana field overrides with "id": "mappings" (value-type) are now converted to column-level cellSettings entries with Value conditions.

4. Handle noValue override → per-column cellSettings

Grafana field overrides with "id": "noValue" are now converted to a cellSettings entry with a Misc condition for "null", displaying the specified fallback text when a cell has no value.

I have added couple of tests for these changes. All the existing 23 tests are passing as well.

Limitations

  • Grafana units without a Perses equivalent (decgbytes, dectbytes, kbytes, mbytes, gbytes, tbytes) are not migrated. These columns are left unformatted. A future Perses enhancement could add support for these scaled byte units.
  • The JoinByColumnValue transform cannot be inferred automatically from Grafana's merge transformation (which works implicitly). Users may need to add this manually after migration for multi-query tables.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@ibakshay ibakshay requested a review from AntoineThebaud as a code owner May 13, 2026 08:25
Signed-off-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com>
@ibakshay ibakshay force-pushed the ibakshay/table-migration-enhancement branch from 9de10c3 to 7625d5f Compare May 13, 2026 08:28
Copy link
Copy Markdown
Member

@Nexucis Nexucis left a comment

Choose a reason for hiding this comment

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

awesome, thank you @ibakshay !

@Nexucis Nexucis added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit d0f6f47 May 19, 2026
16 checks passed
@Nexucis Nexucis deleted the ibakshay/table-migration-enhancement branch May 19, 2026 06:04
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.

Migrator doesn't migrate column overides and values correct

2 participants