Skip to content

Commit

Permalink
fix nop mapper: must return data unmolested
Browse files Browse the repository at this point in the history
  • Loading branch information
voutilad committed Sep 21, 2022
1 parent c492dfe commit d950857
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neo4j_arrow/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def _send_action(self, action: str, body: Dict[str, Any]) -> Dict[str, Any]:
raise e

@classmethod
def _nop(*args, **kwargs):
def _nop(cls, data: Arrow) -> Arrow:
"""Used as a no-op mapping function."""
pass
return data

@classmethod
def _node_mapper(cls, model: Graph, source_field: Optional[str] = None):
Expand Down
9 changes: 9 additions & 0 deletions neo4j_arrow/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
import pyarrow as pa


def test_nop_mapper():
mapper = Neo4jArrowClient._nop
t = pa.table({"labels": ["Junk"], "nodeId": ["junk_id"]})
result = mapper(t)
assert result is not None
assert "nodeId" in result.schema.names
assert "labels" in result.schema.names


def test_node_mapper():
SRC_KEY = "gcs_source"
g = Graph(name="junk", nodes=[Node(source="gs://.*/junk.*parquet",
Expand Down

0 comments on commit d950857

Please sign in to comment.