Add pragmas support to Table Preview queries #2573
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements support for applying pragmas from the Query Settings Dialog to Table Preview queries, ensuring consistent behavior between regular query execution and table previews.
Problem
Previously, when users configured pragmas in the Query Settings Dialog, these pragmas were only applied to regular query executions but not to Table Preview queries. This created inconsistent behavior where:
PRAGMA OrderedColumns; SELECT * FROM tableSELECT * FROM table LIMIT 101(pragmas ignored)Solution
Updated the Table Preview feature to include pragmas from Query Settings, making it consistent with regular query execution:
PRAGMA OrderedColumns; SELECT * FROM tablePRAGMA OrderedColumns; SELECT * FROM table LIMIT 101Changes Made
1. Enhanced Preview API (
src/store/reducers/preview.ts)pragmas?: stringparameter toSendQueryParamsinterfaceprepareQueryWithPragmas()function2. Updated TablePreview Component (
src/containers/Tenant/Query/Preview/components/TablePreview.tsx)useQueryExecutionSettingshook to access current query settings3. Comprehensive Test Coverage (
src/containers/Tenant/Query/Preview/components/__test__/TablePreview.test.tsx)Testing
Example Usage
Implementation Details
prepareQueryWithPragmas()utility functionFixes: table-preview-pragmas (follow-up to PR #2563)
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.