Skip to content

Commit 9fc552e

Browse files
fix: handle missing table in read_table when raise_if_empty=False (BigQuery test_seed_run_results)
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a51ff11 commit 9fc552e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

integration_tests/tests/dbt_project.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ def read_table(
9999
query = self.read_table_query(
100100
table_name, where, group_by, order_by, limit, column_names
101101
)
102-
results = self.run_query(query)
102+
try:
103+
results = self.run_query(query)
104+
except IndexError:
105+
# run_operation returns [] when the query fails (e.g. table/view not found).
106+
# When raise_if_empty=False, treat missing table as empty result.
107+
if raise_if_empty:
108+
raise
109+
return []
103110
if raise_if_empty and len(results) == 0:
104111
raise ValueError(
105112
f"Table '{table_name}' with the '{where}' condition is empty."

0 commit comments

Comments
 (0)