From 09f0e7e1011fc451b3bfb94c4b7764007fc69836 Mon Sep 17 00:00:00 2001 From: Jiwon Park Date: Tue, 4 Apr 2023 02:34:58 +0900 Subject: [PATCH] fix: Wrap the bigquery table name with backtick. (#3577) fix: Add escape the table name Signed-off-by: Jiwon Park --- sdk/python/feast/infra/offline_stores/bigquery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/python/feast/infra/offline_stores/bigquery.py b/sdk/python/feast/infra/offline_stores/bigquery.py index 7871cea02c..973eddc7fb 100644 --- a/sdk/python/feast/infra/offline_stores/bigquery.py +++ b/sdk/python/feast/infra/offline_stores/bigquery.py @@ -503,7 +503,7 @@ def to_bigquery( temp_dest_table = f"{tmp_dest['projectId']}.{tmp_dest['datasetId']}.{tmp_dest['tableId']}" # persist temp table - sql = f"CREATE TABLE {dest} AS SELECT * FROM {temp_dest_table}" + sql = f"CREATE TABLE `{dest}` AS SELECT * FROM {temp_dest_table}" self._execute_query(sql, timeout=timeout) print(f"Done writing to '{dest}'.") @@ -663,7 +663,7 @@ def _upload_entity_df( job: Union[bigquery.job.query.QueryJob, bigquery.job.load.LoadJob] if isinstance(entity_df, str): - job = client.query(f"CREATE TABLE {table_name} AS ({entity_df})") + job = client.query(f"CREATE TABLE `{table_name}` AS ({entity_df})") elif isinstance(entity_df, pd.DataFrame): # Drop the index so that we don't have unnecessary columns