Skip to content

Commit

Permalink
Merge pull request #73 from denhartog/master
Browse files Browse the repository at this point in the history
Should address Issue #65 by compressing annotation in setup_query()
  • Loading branch information
palewire committed Feb 16, 2018
2 parents b3b45a0 + 91f3a49 commit 4a16cb3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions postgres_copy/copy_to.py
Expand Up @@ -27,10 +27,11 @@ def setup_query(self):
for field in self.query.copy_to_fields:
# raises error if field is not available
expression = self.query.resolve_ref(field)
if field in self.query.annotations:
selection = (expression, self.compile(expression), field)
else:
selection = (expression, self.compile(expression), None)
selection = (
expression,
self.compile(expression),
field if field in self.query.annotations else None,
)
self.select.append(selection)

def execute_sql(self, csv_path=None):
Expand Down

0 comments on commit 4a16cb3

Please sign in to comment.