@8ms/helpers 2.4.21 → 2.4.22
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.
|
@@ -4,7 +4,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
* Load data into a given table using Google Cloud Storage.
|
|
5
5
|
*/
|
|
6
6
|
const loadData = async ({ file, googleCloudBigqueryClient, googleCloudStorageClient, table }) => {
|
|
7
|
-
if (await googleCloudBigqueryClient.tableExists(table.datasetId, table.tableId)) await googleCloudBigqueryClient.client.dataset(table.datasetId).table(table.tableId).load(googleCloudStorageClient.client.bucket(file.bucket).file(file.key),
|
|
7
|
+
if (await googleCloudBigqueryClient.tableExists(table.datasetId, table.tableId)) await googleCloudBigqueryClient.client.dataset(table.datasetId, { location: table?.region }).table(table.tableId).load(googleCloudStorageClient.client.bucket(file.bucket).file(file.key), {
|
|
8
|
+
...file?.metadata ?? {},
|
|
9
|
+
location: file?.region
|
|
10
|
+
});
|
|
8
11
|
};
|
|
9
12
|
//#endregion
|
|
10
13
|
exports.loadData = loadData;
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Load data into a given table using Google Cloud Storage.
|
|
4
4
|
*/
|
|
5
5
|
const loadData = async ({ file, googleCloudBigqueryClient, googleCloudStorageClient, table }) => {
|
|
6
|
-
if (await googleCloudBigqueryClient.tableExists(table.datasetId, table.tableId)) await googleCloudBigqueryClient.client.dataset(table.datasetId).table(table.tableId).load(googleCloudStorageClient.client.bucket(file.bucket).file(file.key),
|
|
6
|
+
if (await googleCloudBigqueryClient.tableExists(table.datasetId, table.tableId)) await googleCloudBigqueryClient.client.dataset(table.datasetId, { location: table?.region }).table(table.tableId).load(googleCloudStorageClient.client.bucket(file.bucket).file(file.key), {
|
|
7
|
+
...file?.metadata ?? {},
|
|
8
|
+
location: file?.region
|
|
9
|
+
});
|
|
7
10
|
};
|
|
8
11
|
//#endregion
|
|
9
12
|
export { loadData };
|