Skip to content

Commit 6431246

Browse files
committed
Fixed broken ovewrite option
1 parent 4eeae87 commit 6431246

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

neo4j_uploader/__init__.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def batch_upload(
6767
total_nodes_created = 0
6868
total_relationships_created = 0
6969
total_properties_set = 0
70+
neo4j_creds = (cdata.neo4j_uri, cdata.neo4j_user, cdata.neo4j_password)
71+
neo4j_database = cdata.neo4j_database
72+
73+
# If overwrite enabled, clear db
74+
if cdata.overwrite is True:
75+
reset(neo4j_creds, neo4j_database)
7076

7177
# Get list of tuples containing queries and accompanying params for driver execution
7278
query_params = specification_queries(gdata.nodes, cdata)
@@ -75,10 +81,10 @@ def batch_upload(
7581
for qp in query_params:
7682
# Run queries and retrieve summary of upload
7783
summary = upload_query(
78-
creds = (cdata.neo4j_uri, cdata.neo4j_user, cdata.neo4j_password),
84+
creds = neo4j_creds,
7985
query = qp[0],
8086
params = qp[1],
81-
database = cdata.neo4j_database
87+
database = neo4j_database
8288
)
8389

8490
# Sample summary result
@@ -126,7 +132,7 @@ def upload(
126132
should_overwrite: bool = False,
127133
database_name: str = 'neo4j',
128134
max_batch_size: int = 500,
129-
)-> (float, int, int, int):
135+
)-> UploadResult:
130136
"""
131137
Uploads a dictionary of simple node and relationship records to a target Neo4j instance specified in the arguments.
132138

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "neo4j-uploader"
3-
version = "0.5.2"
3+
version = "0.5.3"
44
description = ""
55
authors = ["Jason Koo <jalakoo@gmail.com>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)