mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
fix(sqllab): pass queryLimit on data preview queries and fix Decimal TypeError in results handler (#37614)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,7 @@ import type { QueryEditor, SqlLabRootState, Table } from '../types';
|
|||||||
import { newQueryTabName } from '../utils/newQueryTabName';
|
import { newQueryTabName } from '../utils/newQueryTabName';
|
||||||
import getInitialState from '../reducers/getInitialState';
|
import getInitialState from '../reducers/getInitialState';
|
||||||
import { rehydratePersistedState } from '../utils/reduxStateToLocalStorageHelper';
|
import { rehydratePersistedState } from '../utils/reduxStateToLocalStorageHelper';
|
||||||
|
import { PREVIEW_QUERY_LIMIT } from '../constants';
|
||||||
|
|
||||||
// Type definitions for SqlLab actions
|
// Type definitions for SqlLab actions
|
||||||
export interface Query {
|
export interface Query {
|
||||||
@@ -1317,6 +1318,7 @@ export function runTablePreviewQuery(
|
|||||||
runAsync: database.allow_run_async,
|
runAsync: database.allow_run_async,
|
||||||
ctas: false,
|
ctas: false,
|
||||||
isDataPreview: true,
|
isDataPreview: true,
|
||||||
|
queryLimit: PREVIEW_QUERY_LIMIT,
|
||||||
};
|
};
|
||||||
if (runPreviewOnly) {
|
if (runPreviewOnly) {
|
||||||
return dispatch(runQuery(dataPreviewQuery, runPreviewOnly));
|
return dispatch(runQuery(dataPreviewQuery, runPreviewOnly));
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import {
|
|||||||
useTableMetadataQuery,
|
useTableMetadataQuery,
|
||||||
} from 'src/hooks/apiResources';
|
} from 'src/hooks/apiResources';
|
||||||
import { runTablePreviewQuery } from 'src/SqlLab/actions/sqlLab';
|
import { runTablePreviewQuery } from 'src/SqlLab/actions/sqlLab';
|
||||||
|
import { PREVIEW_QUERY_LIMIT } from 'src/SqlLab/constants';
|
||||||
import { ActionButton } from '@superset-ui/core/components/ActionButton';
|
import { ActionButton } from '@superset-ui/core/components/ActionButton';
|
||||||
import ResultSet from '../ResultSet';
|
import ResultSet from '../ResultSet';
|
||||||
import ShowSQL from '../ShowSQL';
|
import ShowSQL from '../ShowSQL';
|
||||||
@@ -63,7 +64,6 @@ const TABS_KEYS = {
|
|||||||
SAMPLE: 'sample',
|
SAMPLE: 'sample',
|
||||||
};
|
};
|
||||||
const TAB_HEADER_HEIGHT = 80;
|
const TAB_HEADER_HEIGHT = 80;
|
||||||
const PREVIEW_QUERY_LIMIT = 100;
|
|
||||||
|
|
||||||
const Title = styled.div`
|
const Title = styled.div`
|
||||||
${({ theme }) => css`
|
${({ theme }) => css`
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ export const LOCALSTORAGE_MAX_QUERY_RESULTS_KB = 1 * 1024; // 1M
|
|||||||
export const LOCALSTORAGE_WARNING_THRESHOLD = 0.9;
|
export const LOCALSTORAGE_WARNING_THRESHOLD = 0.9;
|
||||||
export const LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS = 8000; // danger type toast duration
|
export const LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS = 8000; // danger type toast duration
|
||||||
|
|
||||||
|
export const PREVIEW_QUERY_LIMIT = 100;
|
||||||
|
|
||||||
// autocomplete score weights
|
// autocomplete score weights
|
||||||
export const SQL_KEYWORD_AUTOCOMPLETE_SCORE = 100;
|
export const SQL_KEYWORD_AUTOCOMPLETE_SCORE = 100;
|
||||||
export const SQL_FUNCTIONS_AUTOCOMPLETE_SCORE = 90;
|
export const SQL_FUNCTIONS_AUTOCOMPLETE_SCORE = 90;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class SqlExecutionResultsCommand(BaseCommand):
|
|||||||
if not self._blob:
|
if not self._blob:
|
||||||
# Query exists in DB but results not in S3 - enhanced diagnostics
|
# Query exists in DB but results not in S3 - enhanced diagnostics
|
||||||
query_age_seconds = now_as_float() - (
|
query_age_seconds = now_as_float() - (
|
||||||
self._query.end_time if self._query.end_time else now_as_float()
|
float(self._query.end_time) if self._query.end_time else now_as_float()
|
||||||
)
|
)
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"410 Error - Query exists in DB but results not in results backend"
|
"410 Error - Query exists in DB but results not in results backend"
|
||||||
|
|||||||
Reference in New Issue
Block a user