Adding the ability to expand the max number of rows retrieved by SQL queries (say for table exports).

This commit is contained in:
mike12345567 2022-03-21 17:44:43 +00:00
parent 107c593e47
commit 5d9a34963a
2 changed files with 6 additions and 1 deletions

View File

@ -70,6 +70,7 @@ module.exports = {
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
DISABLE_THREADING: process.env.DISABLE_THREADING,
QUERY_THREAD_TIMEOUT: process.env.QUERY_THREAD_TIMEOUT,
SQL_MAX_ROWS: process.env.SQL_MAX_ROWS,
_set(key, value) {
process.env[key] = value
module.exports[key] = value

View File

@ -9,8 +9,12 @@ import {
} from "../../definitions/datasource"
import { isIsoDateString, SqlClients } from "../utils"
import SqlTableQueryBuilder from "./sqlTable"
import environment from "../../environment"
const BASE_LIMIT = 5000
const envLimit = environment.SQL_MAX_ROWS
? parseInt(environment.SQL_MAX_ROWS)
: null
const BASE_LIMIT = envLimit || 5000
type KnexQuery = Knex.QueryBuilder | Knex
// these are invalid dates sent by the client, need to convert them to a real max date