diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.ts b/superset-frontend/src/SqlLab/actions/sqlLab.ts index 3fe01a03071..7d8da1f87cd 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.ts +++ b/superset-frontend/src/SqlLab/actions/sqlLab.ts @@ -46,6 +46,7 @@ import type { QueryEditor, SqlLabRootState, Table } from '../types'; import { newQueryTabName } from '../utils/newQueryTabName'; import getInitialState from '../reducers/getInitialState'; import { rehydratePersistedState } from '../utils/reduxStateToLocalStorageHelper'; +import { PREVIEW_QUERY_LIMIT } from '../constants'; // Type definitions for SqlLab actions export interface Query { @@ -1317,6 +1318,7 @@ export function runTablePreviewQuery( runAsync: database.allow_run_async, ctas: false, isDataPreview: true, + queryLimit: PREVIEW_QUERY_LIMIT, }; if (runPreviewOnly) { return dispatch(runQuery(dataPreviewQuery, runPreviewOnly)); diff --git a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx index ecf8318fd7f..e69fad4473b 100644 --- a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx +++ b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx @@ -41,6 +41,7 @@ import { useTableMetadataQuery, } from 'src/hooks/apiResources'; import { runTablePreviewQuery } from 'src/SqlLab/actions/sqlLab'; +import { PREVIEW_QUERY_LIMIT } from 'src/SqlLab/constants'; import { ActionButton } from '@superset-ui/core/components/ActionButton'; import ResultSet from '../ResultSet'; import ShowSQL from '../ShowSQL'; @@ -63,7 +64,6 @@ const TABS_KEYS = { SAMPLE: 'sample', }; const TAB_HEADER_HEIGHT = 80; -const PREVIEW_QUERY_LIMIT = 100; const Title = styled.div` ${({ theme }) => css` diff --git a/superset-frontend/src/SqlLab/constants.ts b/superset-frontend/src/SqlLab/constants.ts index 6f81f8287ac..1f8753453cb 100644 --- a/superset-frontend/src/SqlLab/constants.ts +++ b/superset-frontend/src/SqlLab/constants.ts @@ -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_MESSAGE_THROTTLE_MS = 8000; // danger type toast duration +export const PREVIEW_QUERY_LIMIT = 100; + // autocomplete score weights export const SQL_KEYWORD_AUTOCOMPLETE_SCORE = 100; export const SQL_FUNCTIONS_AUTOCOMPLETE_SCORE = 90; diff --git a/superset/commands/sql_lab/results.py b/superset/commands/sql_lab/results.py index 0ba5100cada..a3cff3bf1ea 100644 --- a/superset/commands/sql_lab/results.py +++ b/superset/commands/sql_lab/results.py @@ -94,7 +94,7 @@ class SqlExecutionResultsCommand(BaseCommand): if not self._blob: # Query exists in DB but results not in S3 - enhanced diagnostics 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( "410 Error - Query exists in DB but results not in results backend"