diff --git a/databuilder/publisher/neo4j_csv_publisher.py b/databuilder/publisher/neo4j_csv_publisher.py index 4a16145307..1463fafde4 100644 --- a/databuilder/publisher/neo4j_csv_publisher.py +++ b/databuilder/publisher/neo4j_csv_publisher.py @@ -1,6 +1,7 @@ import copy import csv import ctypes +from io import open import logging import time from os import listdir @@ -222,7 +223,7 @@ def _create_indices(self, node_file): # type: (str) -> None LOGGER.info('Creating indices. (Existing indices will be ignored)') - with open(node_file, 'r') as node_csv: + with open(node_file, 'r', encoding='utf8') as node_csv: for node_record in csv.DictReader(node_csv): label = node_record[NODE_LABEL_KEY] if label not in self.labels: @@ -250,7 +251,7 @@ def _publish_node(self, node_file, tx): :return: """ - with open(node_file, 'r') as node_csv: + with open(node_file, 'r', encoding='utf8') as node_csv: for count, node_record in enumerate(csv.DictReader(node_csv)): stmt = self.create_node_merge_statement(node_record=node_record) tx = self._execute_statement(stmt, tx) @@ -306,7 +307,7 @@ def _publish_relation(self, relation_file, tx): LOGGER.info('Pre-processing relation with {}'.format(self._relation_preprocessor)) count = 0 - with open(relation_file, 'r') as relation_csv: + with open(relation_file, 'r', encoding='utf8') as relation_csv: for rel_record in csv.DictReader(relation_csv): stmt, params = self._relation_preprocessor.preprocess_cypher( start_label=rel_record[RELATION_START_LABEL], @@ -322,7 +323,7 @@ def _publish_relation(self, relation_file, tx): LOGGER.info('Executed pre-processing Cypher statement {} times'.format(count)) - with open(relation_file, 'r') as relation_csv: + with open(relation_file, 'r', encoding='utf8') as relation_csv: for count, rel_record in enumerate(csv.DictReader(relation_csv)): stmt = self.create_relationship_merge_statement(rel_record=rel_record) tx = self._execute_statement(stmt, tx, diff --git a/setup.py b/setup.py index 4b57f5fbeb..f916f7273f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -__version__ = '2.5.12' +__version__ = '2.5.13' requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt') with open(requirements_path) as requirements_file: