@malloydata/db-bigquery 0.0.239-dev250226010331 → 0.0.239-dev250227145856

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.
@@ -233,11 +233,7 @@ describe('db:BigQuery', () => {
233
233
  });
234
234
  });
235
235
  const SQL_BLOCK_1 = {
236
- type: 'sql_select',
237
- name: 'block1',
238
- dialect: 'standardsql',
239
236
  connection: 'bigquery',
240
- fields: [],
241
237
  selectStr: `
242
238
  SELECT
243
239
  created_at,
@@ -253,11 +249,7 @@ FROM "inventory_items.parquet"
253
249
  `,
254
250
  };
255
251
  const SQL_BLOCK_2 = {
256
- type: 'sql_select',
257
- name: 'block2',
258
- dialect: 'standardsql',
259
252
  connection: 'bigquery',
260
- fields: [],
261
253
  selectStr: `
262
254
  SELECT
263
255
  created_at,
@@ -1,7 +1,7 @@
1
1
  import { RowMetadata } from '@google-cloud/bigquery';
2
2
  import bigquery from '@google-cloud/bigquery/build/src/types';
3
3
  import { ResourceStream } from '@google-cloud/paginator';
4
- import { Connection, ConnectionConfig, MalloyQueryData, PersistSQLResults, QueryData, QueryDataRow, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, TableSourceDef, SQLSourceDef } from '@malloydata/malloy';
4
+ import { Connection, ConnectionConfig, MalloyQueryData, PersistSQLResults, QueryData, QueryDataRow, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, TableSourceDef, SQLSourceDef, SQLSourceRequest } from '@malloydata/malloy';
5
5
  import { BaseConnection, TableMetadata } from '@malloydata/malloy/connection';
6
6
  export interface BigQueryManagerOptions {
7
7
  credentials?: {
@@ -80,7 +80,7 @@ export declare class BigQueryConnection extends BaseConnection implements Connec
80
80
  manifestTemporaryTable(sqlCommand: string): Promise<string>;
81
81
  manifestPermanentTable(sqlCommand: string, datasetName: string, tableName: string, overwriteExistingTable?: boolean, createDataset?: boolean): Promise<string>;
82
82
  private addFieldsToStructDef;
83
- fetchSelectSchema(sqlSource: SQLSourceDef): Promise<SQLSourceDef | string>;
83
+ fetchSelectSchema(sqlSource: SQLSourceRequest): Promise<SQLSourceDef | string>;
84
84
  fetchTableSchema(tableName: string, tablePath: string): Promise<TableSourceDef | string>;
85
85
  private getSQLBlockSchema;
86
86
  private createBigQueryJobAndGetResults;
@@ -392,9 +392,14 @@ class BigQueryConnection extends connection_1.BaseConnection {
392
392
  }
393
393
  async fetchSelectSchema(sqlSource) {
394
394
  try {
395
- const ret = { ...sqlSource };
396
- ret.fields = [];
397
- this.addFieldsToStructDef(ret, await this.getSQLBlockSchema(sqlSource));
395
+ const ret = {
396
+ type: 'sql_select',
397
+ ...sqlSource,
398
+ dialect: this.dialectName,
399
+ fields: [],
400
+ name: (0, malloy_1.sqlKey)(sqlSource.connection, sqlSource.selectStr),
401
+ };
402
+ this.addFieldsToStructDef(ret, await this.getSQLBlockSchema(ret));
398
403
  return ret;
399
404
  }
400
405
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-bigquery",
3
- "version": "0.0.239-dev250226010331",
3
+ "version": "0.0.239-dev250227145856",
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": "^7.3.0",
26
26
  "@google-cloud/common": "^5.0.1",
27
27
  "@google-cloud/paginator": "^5.0.0",
28
- "@malloydata/malloy": "^0.0.239-dev250226010331",
28
+ "@malloydata/malloy": "^0.0.239-dev250227145856",
29
29
  "gaxios": "^4.2.0"
30
30
  }
31
31
  }