Skip to content

Commit

Permalink
expose dataset location option for BQ spark
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsmosowi committed Jul 5, 2021
1 parent cf1857e commit 154be1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ft_build/sparksLib/bigqueryIndex.ts
Expand Up @@ -163,7 +163,7 @@ const transformToSQLType = (ftType: string) => {
};

const bigqueryIndex = async (payload, sparkContext) => {
const { objectID, index, fieldsToSync, projectID } = payload;
const { objectID, index, fieldsToSync, projectID, datasetLocation } = payload;

const { triggerType, change, fieldTypes } = sparkContext;
const record = rowReducer(fieldsToSync, sparkContext.row);
Expand All @@ -178,7 +178,9 @@ const bigqueryIndex = async (payload, sparkContext) => {

// create dataset with exact name "firetable" if not exists
async function preprocessDataset() {
const dataset = bigquery.dataset("firetable");
const dataset = bigquery.dataset("firetable", {
location: datasetLocation ?? "US",
});
const res = await dataset.exists();
const exists = res[0];
if (!exists) {
Expand Down

0 comments on commit 154be1e

Please sign in to comment.