From 2e8ba3825d37acb0a6711020fcde42a7c0d1cf32 Mon Sep 17 00:00:00 2001 From: thewesleyee Date: Thu, 12 Sep 2024 16:27:16 +0800 Subject: [PATCH] replace all occurrences of __QUESTION_MARK__ with ? --- lib/helpers.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 86eb82e..ea422ae 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -8,8 +8,10 @@ const readline = require("readline"), let s3Metadata = null; function startQueryExecution(config) { + let queryString = SqlString.format(config.sql, config.QueryParams || []); + queryString = queryString.replace(/__QUESTION_MARK__/g, "?"); const params = { - QueryString: SqlString.format(config.sql, config.QueryParams || []), + QueryString: queryString, WorkGroup: config.workgroup, ResultConfiguration: { OutputLocation: config.s3Bucket, @@ -95,7 +97,7 @@ async function getQueryResultsFromS3(params) { }; const queryResults = await params.config.athena.getQueryResults( - paginationParams + paginationParams, ); if (params.config.formatJson) { return { @@ -184,12 +186,12 @@ async function cleanUpDML(input, ignoreEmpty) { }) .on("data", (data) => { cleanJson.push( - addDataType(JSON.parse(data.toString("utf8")), dataTypes) + addDataType(JSON.parse(data.toString("utf8")), dataTypes), ); }) .on("finish", function () { resolve(cleanJson); - }) + }), ); }); } @@ -261,15 +263,15 @@ function validateConstructor(init) { throw new TypeError("Config object not present in the constructor"); if (!init.athena) throw new TypeError( - "Athena object not present or incorrect in the constructor" + "Athena object not present or incorrect in the constructor", ); if (!init.s3) throw new TypeError( - "S3 object not present or incorrect in the constructor" + "S3 object not present or incorrect in the constructor", ); if (!init.s3Bucket) throw new TypeError( - "S3 bucket and prefix not present or incorrect in the constructor" + "S3 bucket and prefix not present or incorrect in the constructor", ); }