@malloydata/db-bigquery 0.0.27-dev230309223722 → 0.0.27-dev230310001113
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.
|
@@ -24,7 +24,8 @@ interface BigQueryConnectionConfiguration {
|
|
|
24
24
|
interface SchemaInfo {
|
|
25
25
|
schema: bigquery.ITableFieldSchema;
|
|
26
26
|
needsTableSuffixPseudoColumn: boolean;
|
|
27
|
-
|
|
27
|
+
needsPartitionTimePseudoColumn: boolean;
|
|
28
|
+
needsPartitionDatePseudoColumn: boolean;
|
|
28
29
|
}
|
|
29
30
|
declare type QueryOptionsReader = Partial<BigQueryQueryOptions> | (() => Partial<BigQueryQueryOptions>);
|
|
30
31
|
export declare class BigQueryAuthenticationError extends Error {
|
|
@@ -214,7 +214,7 @@ class BigQueryConnection {
|
|
|
214
214
|
return this.structDefFromTableSchema(`${destinationTable.projectId}.${destinationTable.datasetId}.${destinationTable.tableId}`, dryRunResults.metadata.statistics.query.schema);
|
|
215
215
|
}
|
|
216
216
|
async getTableFieldSchema(tableURL) {
|
|
217
|
-
var _a, _b;
|
|
217
|
+
var _a, _b, _c, _d;
|
|
218
218
|
const { tablePath: tableName } = (0, malloy_1.parseTableURI)(tableURL);
|
|
219
219
|
const segments = tableName.split('.');
|
|
220
220
|
// paths can have two or three segments
|
|
@@ -244,8 +244,11 @@ class BigQueryConnection {
|
|
|
244
244
|
return {
|
|
245
245
|
schema: metadata.schema,
|
|
246
246
|
needsTableSuffixPseudoColumn: needTableSuffixPseudoColumn,
|
|
247
|
-
|
|
247
|
+
needsPartitionTimePseudoColumn: ((_a = metadata.timePartitioning) === null || _a === void 0 ? void 0 : _a.type) !== undefined &&
|
|
248
248
|
((_b = metadata.timePartitioning) === null || _b === void 0 ? void 0 : _b.field) === undefined,
|
|
249
|
+
needsPartitionDatePseudoColumn: ((_c = metadata.timePartitioning) === null || _c === void 0 ? void 0 : _c.type) !== undefined &&
|
|
250
|
+
((_d = metadata.timePartitioning) === null || _d === void 0 ? void 0 : _d.field) === undefined &&
|
|
251
|
+
metadata.timePartitioning.type === 'DAY',
|
|
249
252
|
};
|
|
250
253
|
}
|
|
251
254
|
catch (e) {
|
|
@@ -422,12 +425,18 @@ class BigQueryConnection {
|
|
|
422
425
|
name: '_TABLE_SUFFIX',
|
|
423
426
|
});
|
|
424
427
|
}
|
|
425
|
-
if (schemaInfo.
|
|
428
|
+
if (schemaInfo.needsPartitionTimePseudoColumn) {
|
|
426
429
|
structDef.fields.push({
|
|
427
430
|
type: 'timestamp',
|
|
428
431
|
name: '_PARTITIONTIME',
|
|
429
432
|
});
|
|
430
433
|
}
|
|
434
|
+
if (schemaInfo.needsPartitionDatePseudoColumn) {
|
|
435
|
+
structDef.fields.push({
|
|
436
|
+
type: 'date',
|
|
437
|
+
name: '_PARTITIONDATE',
|
|
438
|
+
});
|
|
439
|
+
}
|
|
431
440
|
return structDef;
|
|
432
441
|
}
|
|
433
442
|
structDefFromSQLSchema(sqlBlock, tableFieldSchema) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-bigquery",
|
|
3
|
-
"version": "0.0.27-
|
|
3
|
+
"version": "0.0.27-dev230310001113",
|
|
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.27-
|
|
28
|
+
"@malloydata/malloy": "^0.0.27-dev230310001113",
|
|
29
29
|
"gaxios": "^4.2.0"
|
|
30
30
|
}
|
|
31
31
|
}
|