Skip to content

Commit 146ad95

Browse files
committed
add query failure debug
1 parent e93d40e commit 146ad95

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/python/idc_index_data_manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ def execute_sql_query(
254254
"""
255255
with Path(file_path).open("r") as file:
256256
sql_query = file.read()
257+
# add try/catch and print query if error occurs to help with debugging
258+
try:
259+
query_job_result = self.client.query(sql_query).result()
260+
except Exception as e:
261+
logger.error("Error occurred while executing SQL query from file: %s", file_path)
262+
logger.error(e)
263+
raise e
257264
query_job_result = self.client.query(sql_query).result()
258265
schema = query_job_result.schema # Get schema from BigQuery QueryJob
259266
index_df = query_job_result.to_dataframe()

0 commit comments

Comments
 (0)