Skip to content

Commit 73af2fa

Browse files
Create the BQ dataset in the location specified in feature_store.yaml if the dataset doesn't exists (#1959)
* fixes #1958 Signed-off-by: François Serra <francois.serra@adeo.com> * Fix lint Signed-off-by: Achal Shah <achals@gmail.com> * Fix lint Signed-off-by: Achal Shah <achals@gmail.com> Co-authored-by: Achal Shah <achals@gmail.com>
1 parent 640fd68 commit 73af2fa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sdk/python/feast/infra/offline_stores/bigquery.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ def get_historical_features(
136136
assert isinstance(config.offline_store, BigQueryOfflineStoreConfig)
137137

138138
table_reference = _get_table_reference_for_new_entity(
139-
client, client.project, config.offline_store.dataset
139+
client,
140+
client.project,
141+
config.offline_store.dataset,
142+
config.offline_store.location,
140143
)
141144

142145
@contextlib.contextmanager
@@ -340,13 +343,16 @@ def _wait_until_done(bq_job):
340343

341344

342345
def _get_table_reference_for_new_entity(
343-
client: Client, dataset_project: str, dataset_name: str
346+
client: Client,
347+
dataset_project: str,
348+
dataset_name: str,
349+
dataset_location: Optional[str],
344350
) -> str:
345351
"""Gets the table_id for the new entity to be uploaded."""
346352

347353
# First create the BigQuery dataset if it doesn't exist
348354
dataset = bigquery.Dataset(f"{dataset_project}.{dataset_name}")
349-
dataset.location = "US"
355+
dataset.location = dataset_location if dataset_location else "US"
350356

351357
try:
352358
client.get_dataset(dataset)

0 commit comments

Comments
 (0)