@malloydata/db-bigquery 0.0.24-dev230228224434 → 0.0.24-dev230301165401
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.
|
@@ -23,7 +23,8 @@ interface BigQueryConnectionConfiguration {
|
|
|
23
23
|
}
|
|
24
24
|
interface SchemaInfo {
|
|
25
25
|
schema: bigquery.ITableFieldSchema;
|
|
26
|
-
|
|
26
|
+
needsTableSuffixPseudoColumn: boolean;
|
|
27
|
+
needsPartitionPseudoColumn: boolean;
|
|
27
28
|
}
|
|
28
29
|
declare type QueryOptionsReader = Partial<BigQueryQueryOptions> | (() => Partial<BigQueryQueryOptions>);
|
|
29
30
|
export declare class BigQueryAuthenticationError extends Error {
|
|
@@ -236,13 +236,15 @@ class BigQueryConnection {
|
|
|
236
236
|
// this is better than creating a new BQ instance every time we need to get a table schema.
|
|
237
237
|
if (projectId)
|
|
238
238
|
this.bigQuery.projectId = projectId;
|
|
239
|
+
const needTableSuffixPseudoColumn = tableNamePart && tableNamePart[tableNamePart.length - 1] === '*';
|
|
239
240
|
const table = this.bigQuery.dataset(datasetNamePart).table(tableNamePart);
|
|
240
241
|
const metadataPromise = table.getMetadata();
|
|
241
242
|
this.bigQuery.projectId = this.projectId;
|
|
242
243
|
const [metadata] = await metadataPromise;
|
|
243
244
|
return {
|
|
244
245
|
schema: metadata.schema,
|
|
245
|
-
|
|
246
|
+
needsTableSuffixPseudoColumn: needTableSuffixPseudoColumn,
|
|
247
|
+
needsPartitionPseudoColumn: ((_a = metadata.timePartitioning) === null || _a === void 0 ? void 0 : _a.type) !== undefined &&
|
|
246
248
|
((_b = metadata.timePartitioning) === null || _b === void 0 ? void 0 : _b.field) === undefined,
|
|
247
249
|
};
|
|
248
250
|
}
|
|
@@ -414,7 +416,13 @@ class BigQueryConnection {
|
|
|
414
416
|
fields: [],
|
|
415
417
|
};
|
|
416
418
|
this.addFieldsToStructDef(structDef, schemaInfo.schema);
|
|
417
|
-
if (schemaInfo.
|
|
419
|
+
if (schemaInfo.needsTableSuffixPseudoColumn) {
|
|
420
|
+
structDef.fields.push({
|
|
421
|
+
type: 'string',
|
|
422
|
+
name: '_TABLE_SUFFIX',
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
if (schemaInfo.needsPartitionPseudoColumn) {
|
|
418
426
|
structDef.fields.push({
|
|
419
427
|
type: 'timestamp',
|
|
420
428
|
name: '_PARTITIONTIME',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-bigquery",
|
|
3
|
-
"version": "0.0.24-
|
|
3
|
+
"version": "0.0.24-dev230301165401",
|
|
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.24-
|
|
28
|
+
"@malloydata/malloy": "^0.0.24-dev230301165401",
|
|
29
29
|
"gaxios": "^4.2.0"
|
|
30
30
|
}
|
|
31
31
|
}
|