From 180a7bd120ef6f0f8f09410dae0dd92e7ef0224c Mon Sep 17 00:00:00 2001 From: Simon Kelly Date: Fri, 11 Dec 2020 16:34:42 +0200 Subject: [PATCH 1/3] don't evaluate the generator --- commcare_export/minilinq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commcare_export/minilinq.py b/commcare_export/minilinq.py index 66aa79f2..9db8ae52 100644 --- a/commcare_export/minilinq.py +++ b/commcare_export/minilinq.py @@ -434,7 +434,7 @@ def eval(self, env): env.emit_table(TableSpec( name=self.table, headings=[heading.eval(env) for heading in self.headings], - rows=list(map(self.coerce_row, rows)), + rows=map(self.coerce_row, rows), data_types=[lit.v for lit in self.data_types] )) From e09fb75c2ad7d7be4f8e09bb510b9b191e37f581 Mon Sep 17 00:00:00 2001 From: Simon Kelly Date: Fri, 11 Dec 2020 16:38:40 +0200 Subject: [PATCH 2/3] remove rows from TableSpec equality and json --- commcare_export/specs.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/commcare_export/specs.py b/commcare_export/specs.py index d5b1e0a6..a121e36e 100644 --- a/commcare_export/specs.py +++ b/commcare_export/specs.py @@ -13,7 +13,6 @@ def __eq__(self, other): isinstance(other, TableSpec) and other.name == self.name and other.headings == self.headings - and other.rows == self.rows and other.data_types == self.data_types ) @@ -21,6 +20,5 @@ def toJSON(self): return { 'name': self.name, 'headings': self.headings, - 'rows': self.rows, 'data_types': self.data_types, } From 27751f95b741b77affd5f757a58c17633b20d5a1 Mon Sep 17 00:00:00 2001 From: Simon Kelly Date: Fri, 11 Dec 2020 16:59:19 +0200 Subject: [PATCH 3/3] update memory writer --- commcare_export/writers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commcare_export/writers.py b/commcare_export/writers.py index e9b56f11..a13ba6eb 100644 --- a/commcare_export/writers.py +++ b/commcare_export/writers.py @@ -210,9 +210,9 @@ def write_table(self, table): else: assert self.tables[table.name].headings == list(table.headings) - self.tables[table.name].rows.extend( + self.tables[table.name].rows = list(self.tables[table.name].rows) + [ [to_jvalue(v) for v in row] for row in table.rows - ) + ] class StreamingMarkdownTableWriter(TableWriter):