@malloydata/db-bigquery 0.0.43-dev230620232755 → 0.0.43-dev230621164941

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.
@@ -153,7 +153,7 @@ class BigQueryConnection {
153
153
  return true;
154
154
  }
155
155
  async _runSQL(sqlCommand, options = {}, rowIndex = 0) {
156
- var _a, _b, _c, _d, _e;
156
+ var _a, _b, _c, _d;
157
157
  const defaultOptions = this.readQueryOptions();
158
158
  const pageSize = (_a = options.rowLimit) !== null && _a !== void 0 ? _a : defaultOptions.rowLimit;
159
159
  try {
@@ -165,12 +165,8 @@ class BigQueryConnection {
165
165
  const totalRows = +(((_b = jobResult[2]) === null || _b === void 0 ? void 0 : _b.totalRows)
166
166
  ? jobResult[2].totalRows
167
167
  : '0');
168
- // TODO need to probably surface the cause of the schema not present error
169
- if (((_c = jobResult[2]) === null || _c === void 0 ? void 0 : _c.schema) === undefined) {
170
- throw new Error('Schema not present');
171
- }
172
168
  // TODO even though we have 10 minute timeout limit, we still should confirm that resulting metadata has "jobComplete: true"
173
- const queryCostBytes = (_d = jobResult[2]) === null || _d === void 0 ? void 0 : _d.totalBytesProcessed;
169
+ const queryCostBytes = (_c = jobResult[2]) === null || _c === void 0 ? void 0 : _c.totalBytesProcessed;
174
170
  const data = {
175
171
  rows: jobResult[0],
176
172
  totalRows,
@@ -178,7 +174,7 @@ class BigQueryConnection {
178
174
  queryCostBytes: queryCostBytes ? +queryCostBytes : undefined,
179
175
  },
180
176
  };
181
- const schema = (_e = jobResult[2]) === null || _e === void 0 ? void 0 : _e.schema;
177
+ const schema = (_d = jobResult[2]) === null || _d === void 0 ? void 0 : _d.schema;
182
178
  return { data, schema };
183
179
  }
184
180
  catch (e) {
@@ -191,6 +187,10 @@ class BigQueryConnection {
191
187
  }
192
188
  async runSQLBlockAndFetchResultSchema(sqlBlock, options) {
193
189
  const { data, schema: schemaRaw } = await this._runSQL(sqlBlock.selectStr, options);
190
+ // TODO need to probably surface the cause of the schema not present error
191
+ if (schemaRaw === undefined) {
192
+ throw new Error('Schema not present');
193
+ }
194
194
  const schema = this.structDefFromSQLSchema(sqlBlock, schemaRaw);
195
195
  return { data, schema };
196
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-bigquery",
3
- "version": "0.0.43-dev230620232755",
3
+ "version": "0.0.43-dev230621164941",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "@google-cloud/bigquery": "^5.5.0",
26
26
  "@google-cloud/common": "^3.6.0",
27
27
  "@google-cloud/paginator": "^4.0.1",
28
- "@malloydata/malloy": "^0.0.43-dev230620232755",
28
+ "@malloydata/malloy": "^0.0.43-dev230621164941",
29
29
  "gaxios": "^4.2.0"
30
30
  }
31
31
  }