From 18431bc5dfa0c9127f43965ef246e42f10303e5e Mon Sep 17 00:00:00 2001 From: Danny Chiao Date: Sat, 11 Sep 2021 00:22:55 -0400 Subject: [PATCH] Add MVP support for on demand transforms for bigquery Signed-off-by: Danny Chiao --- sdk/python/feast/infra/offline_stores/bigquery.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk/python/feast/infra/offline_stores/bigquery.py b/sdk/python/feast/infra/offline_stores/bigquery.py index afb2a35b18..0da4a329ec 100644 --- a/sdk/python/feast/infra/offline_stores/bigquery.py +++ b/sdk/python/feast/infra/offline_stores/bigquery.py @@ -221,6 +221,17 @@ def to_bigquery( path = f"{self.client.project}.{self.config.offline_store.dataset}.historical_{today}_{rand_id}" job_config = bigquery.QueryJobConfig(destination=path) + if not job_config.dry_run and self.on_demand_feature_views is not None: + transformed_df = self.to_df() + job = self.client.load_table_from_dataframe( + transformed_df, + job_config.destination, + job_config=bigquery.LoadJobConfig(), + ) + job.result() + print(f"Done writing to '{job_config.destination}'.") + return str(job_config.destination) + bq_job = self.client.query(self.query, job_config=job_config) if job_config.dry_run: