@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), file.metadata);
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;
@@ -7,10 +7,12 @@ type LoadData = {
7
7
  file: {
8
8
  bucket: string;
9
9
  key: string;
10
- metadata: object;
10
+ metadata?: object;
11
+ region?: string;
11
12
  };
12
13
  table: {
13
14
  datasetId: string;
15
+ region?: string;
14
16
  tableId: string;
15
17
  };
16
18
  };
@@ -7,10 +7,12 @@ type LoadData = {
7
7
  file: {
8
8
  bucket: string;
9
9
  key: string;
10
- metadata: object;
10
+ metadata?: object;
11
+ region?: string;
11
12
  };
12
13
  table: {
13
14
  datasetId: string;
15
+ region?: string;
14
16
  tableId: string;
15
17
  };
16
18
  };
@@ -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), file.metadata);
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.4.21",
4
+ "version": "2.4.22",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"