Skip to content

Commit

Permalink
fixed export to CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
minus34 committed Nov 22, 2022
1 parent 44d914d commit 2616dae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions create_concordance_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,11 @@ def export_to_csv(pg_cur, table, file_name):
to_source,
to_bdy
) TO STDOUT WITH CSV HEADER"""
with open(os.path.join(settings.output_path, file_name), "w") as f:

with open(os.path.join(settings.output_path, file_name), "wb") as f:
with pg_cur.copy(query) as copy:
while data := f.read():
copy.write(data)
while data := copy.read():
f.write(data)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions data/boundary_concordance_score.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from_source,from_bdy,to_source,to_bdy,concordance_percent,error_percent
abs 2016,gcc,abs 2021,gccsa,100,
abs 2016,lga,abs 2016,sa3,74,4.7
abs 2016,lga,abs 2016,sa3,73,4.7
abs 2016,lga,abs 2016,ste,100,0.2
abs 2016,poa,abs 2016,lga,93,1.4
abs 2016,poa,abs 2016,sa2,62,8.6
abs 2016,poa,abs 2016,sa2,62,8.7
abs 2016,sa1,abs 2016,gcc,100,0.0
abs 2016,sa1,abs 2016,sa2,100,0.0
abs 2016,sa1,abs 2016,sa3,100,0.0
Expand Down

0 comments on commit 2616dae

Please sign in to comment.