Skip to content

Commit

Permalink
unbreak graph import
Browse files Browse the repository at this point in the history
Bad logic resulted in not sending the database name when doing a
projection, so wire in some more conditionals. The start method is now a
mess, but let's get it working for now.
  • Loading branch information
voutilad committed Apr 12, 2023
1 parent 881dca2 commit e34b93b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion neo4j_arrow/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,27 @@ def _write_batches(self, desc: Dict[str, Any],
def start(self, action: str = "CREATE_GRAPH", *,
config: Dict[str, Any] = {},
force: bool = False) -> Dict[str, Any]:
"""
Start an import job. Defaults to graph (projection) import.
Note: for database creation, you must currently set action to the string
value "CREATE_DATABASE". If doing so, force will determine if we attempt
to overrite any existing database.
TODO: XXX: this method needs rework into 2 different methods
"""
assert not self.debug or self.state == ClientState.READY
if not config:
config = {
"name": self.graph,
"concurrency": self.concurrency,
"force": force,
}
if action == "CREATE_DATABASE":
if force:
config.update({ "force": force })
else:
config.update({ "database_name": self.database })

# TODO: assert config has mandatory fields
try:
result = self._send_action(action, config)
Expand Down

0 comments on commit e34b93b

Please sign in to comment.