Skip to content

Commit

Permalink
Fix for empty results df_from_query_by_keys, ty Emeka
Browse files Browse the repository at this point in the history
  • Loading branch information
jlubken committed Feb 10, 2022
1 parent 22cda26 commit e1ab7b2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dsdk/persistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ def df_from_query_by_keys(
fout.write(rendered)
cur.execute(rendered)
rows = cur.fetchall()
df = DataFrame(rows)
columns = (each[0] for each in cur.description)
df.columns = columns
if rows:
df = DataFrame(rows)
df.columns = columns
else:
df = DataFrame(columns=columns)
return df

@classmethod
Expand Down

0 comments on commit e1ab7b2

Please sign in to comment.