@malloydata/db-bigquery 0.0.109-dev231201200035 → 0.0.109
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.
|
@@ -20,12 +20,12 @@ interface CredentialBody {
|
|
|
20
20
|
private_key?: string;
|
|
21
21
|
}
|
|
22
22
|
interface BigQueryConnectionConfiguration {
|
|
23
|
-
|
|
23
|
+
projectId?: string /** This ID is used for Bigquery Table Normalization */;
|
|
24
24
|
serviceAccountKeyPath?: string;
|
|
25
25
|
location?: string;
|
|
26
26
|
maximumBytesBilled?: string;
|
|
27
27
|
timeoutMs?: string;
|
|
28
|
-
|
|
28
|
+
billingProjectId?: string;
|
|
29
29
|
credentials?: CredentialBody;
|
|
30
30
|
}
|
|
31
31
|
interface SchemaInfo {
|
|
@@ -43,9 +43,9 @@ export declare class BigQueryConnection implements Connection, PersistSQLResults
|
|
|
43
43
|
private readonly dialect;
|
|
44
44
|
static DEFAULT_QUERY_OPTIONS: BigQueryQueryOptions;
|
|
45
45
|
private bigQuery;
|
|
46
|
-
private
|
|
46
|
+
private billingProjectId;
|
|
47
47
|
private temporaryTables;
|
|
48
|
-
private
|
|
48
|
+
private projectId;
|
|
49
49
|
private schemaCache;
|
|
50
50
|
private sqlSchemaCache;
|
|
51
51
|
private queryOptions?;
|
|
@@ -98,12 +98,12 @@ class BigQueryConnection {
|
|
|
98
98
|
userAgent: `Malloy/${malloy_1.Malloy.version}`,
|
|
99
99
|
keyFilename: config.serviceAccountKeyPath,
|
|
100
100
|
credentials: config.credentials,
|
|
101
|
-
projectId: config.
|
|
101
|
+
projectId: config.billingProjectId,
|
|
102
102
|
});
|
|
103
103
|
// record project ID because for unclear reasons we have to modify the project ID on the SDK when
|
|
104
104
|
// we want to use the tables API
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
105
|
+
this.billingProjectId = this.bigQuery.projectId;
|
|
106
|
+
this.projectId = config.projectId || this.bigQuery.projectId;
|
|
107
107
|
this.queryOptions = queryOptions;
|
|
108
108
|
this.config = config;
|
|
109
109
|
this.location = config.location || 'US';
|
|
@@ -206,7 +206,7 @@ class BigQueryConnection {
|
|
|
206
206
|
}
|
|
207
207
|
normalizeTablePath(tablePath) {
|
|
208
208
|
if (tablePath.split('.').length === 2) {
|
|
209
|
-
return `${this.
|
|
209
|
+
return `${this.projectId}.${tablePath}`;
|
|
210
210
|
}
|
|
211
211
|
else {
|
|
212
212
|
return tablePath;
|
|
@@ -231,7 +231,7 @@ class BigQueryConnection {
|
|
|
231
231
|
tableNamePart[tableNamePart.length - 1] === '*';
|
|
232
232
|
const table = this.bigQuery.dataset(datasetNamePart).table(tableNamePart);
|
|
233
233
|
const metadataPromise = table.getMetadata();
|
|
234
|
-
this.bigQuery.projectId = this.
|
|
234
|
+
this.bigQuery.projectId = this.billingProjectId;
|
|
235
235
|
const [metadata] = await metadataPromise;
|
|
236
236
|
return {
|
|
237
237
|
schema: metadata.schema,
|
|
@@ -568,7 +568,7 @@ class BigQueryConnection {
|
|
|
568
568
|
query: sqlCommand,
|
|
569
569
|
dryRun,
|
|
570
570
|
});
|
|
571
|
-
const url = `https://console.cloud.google.com/bigquery?project=${this.
|
|
571
|
+
const url = `https://console.cloud.google.com/bigquery?project=${this.billingProjectId}&j=bq:${this.location}:${job.id}&page=queryresults`;
|
|
572
572
|
return url;
|
|
573
573
|
}
|
|
574
574
|
runSQLStream(sqlCommand, { rowLimit, abortSignal } = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-bigquery",
|
|
3
|
-
"version": "0.0.109
|
|
3
|
+
"version": "0.0.109",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
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.109
|
|
29
|
-
"@malloydata/malloy-interfaces": "^0.0.109
|
|
28
|
+
"@malloydata/malloy": "^0.0.109",
|
|
29
|
+
"@malloydata/malloy-interfaces": "^0.0.109",
|
|
30
30
|
"gaxios": "^4.2.0"
|
|
31
31
|
}
|
|
32
32
|
}
|