From 98ac44d450d7970f5289d520199e238f372dc2d8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 12 Apr 2016 20:36:34 -0400 Subject: [PATCH] added check for if zero rows are returned by query --- records.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/records.py b/records.py index c791b60..c4ddb48 100644 --- a/records.py +++ b/records.py @@ -165,6 +165,11 @@ class RecordCollection(object): # Create a new Tablib Dataset. data = tablib.Dataset() + # If the RecordCollection is empty, just return the empty set + # Check number of rows by typecasting to list + if len(list(self)) == 0: + return data + # Set the column names as headers on Tablib Dataset. first = self[0]