Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 2211f1b

Browse files
HaipengSuYasser Elsayed
authored andcommitted
Resolve issue where exception occurs when running bigquery.execute with empty query result. (#362)
1 parent 2f40e2e commit 2211f1b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

google/datalab/bigquery/_table.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ def to_dataframe(self, start_row=0, max_rows=None):
609609
# Collect results of page fetcher in separate dataframe objects, then
610610
# concatenate them to reduce the amount of copying
611611
df_list = []
612+
df = None
612613

613614
while True:
614615
page_rows, page_token = fetcher(page_token, count)
@@ -617,7 +618,8 @@ def to_dataframe(self, start_row=0, max_rows=None):
617618
df_list.append(pandas.DataFrame.from_records(page_rows))
618619
if not page_token:
619620
break
620-
df = pandas.concat(df_list, ignore_index=True, copy=False)
621+
if df_list:
622+
df = pandas.concat(df_list, ignore_index=True, copy=False)
621623

622624
# Need to reorder the dataframe to preserve column ordering
623625
ordered_fields = [field.name for field in self.schema]

0 commit comments

Comments
 (0)