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

Refactor + Fix for making table headers #45

Merged
merged 5 commits into from
Jun 11, 2024
Merged

Refactor + Fix for making table headers #45

merged 5 commits into from
Jun 11, 2024

Conversation

balaji-jr
Copy link
Contributor

Issue:
In the query response, not all keys may be present, leading to columns in the displayed table having mismatching headers, as these headers are derived from the keys of the first record.

Fix:
Determining headers on two scenarios:

  1. When the query includes '*', indicating the selection of all columns, headers are generated from the schema by mapping parseable data types to Grafana's own data types. Any gaps are filled by iterating over the generated data frame.

  2. If the query selectively chooses columns, headers are created from the first record, assuming that the SQL query results fill any gaps.

@balaji-jr balaji-jr requested a review from nitisht June 10, 2024 15:45
@balaji-jr balaji-jr self-assigned this Jun 10, 2024
src/datasource.ts Outdated Show resolved Hide resolved
@nitisht
Copy link
Member

nitisht commented Jun 11, 2024

Fixes #44

@nitisht nitisht mentioned this pull request Jun 11, 2024
@balaji-jr balaji-jr merged commit f61dbdf into main Jun 11, 2024
2 checks passed
@balaji-jr balaji-jr deleted the ISSUE-44 branch June 11, 2024 09:33
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants