@malloydata/db-trino 0.0.138-dev240331204754 → 0.0.138-dev240401005446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/trino_connection.js +2 -5
- package/package.json +1 -1
package/dist/trino_connection.js
CHANGED
|
@@ -167,18 +167,15 @@ class TrinoConnection {
|
|
|
167
167
|
// TODO(figutierrez): Use.
|
|
168
168
|
_rowIndex = 0) {
|
|
169
169
|
var _a, _b;
|
|
170
|
-
//sqlCommand = sqlCommand.replace(new RegExp('`', 'g'), '');
|
|
171
|
-
// TODO: default row limit.
|
|
172
|
-
sqlCommand = `SELECT * FROM (${sqlCommand}) limit ${(_a = options.rowLimit) !== null && _a !== void 0 ? _a : 50}`;
|
|
173
|
-
// TODO: fill in with options.
|
|
174
170
|
const result = await this.trino.query(sqlCommand);
|
|
175
171
|
let queryResult = await result.next();
|
|
176
172
|
if (queryResult.value.error) {
|
|
177
173
|
// TODO: handle.
|
|
178
174
|
throw new Error(`Failed to execute sql: ${sqlCommand}. \n Error: ${JSON.stringify(queryResult.value.error)}`);
|
|
179
175
|
}
|
|
176
|
+
let maxRows = (_a = options.rowLimit) !== null && _a !== void 0 ? _a : 50;
|
|
180
177
|
const malloyRows = [];
|
|
181
|
-
while (queryResult !== null) {
|
|
178
|
+
while (queryResult !== null && maxRows--) {
|
|
182
179
|
const rows = (_b = queryResult.value.data) !== null && _b !== void 0 ? _b : [];
|
|
183
180
|
for (const row of rows) {
|
|
184
181
|
const malloyRow = {};
|