To convert relational data into CSV files compatible with neo4j-admin import using the data2neo library, you can achieve this by using the conversion schema to define the transformation logic and export the resulting nodes and relationships into CSV files. However, data2neo itself does not natively generate CSV files for neo4j-admin import; its primary purpose is to directly load data into a Neo4j database.
To adapt the process for generating CSV files, you can modify the workflow to format the output as CSV files instead of committing the data to a Neo4j instance. Here's how you can do it:
Step 1: Define the Conversion Schema
The conversion schema defines how relational entities are mapped to nodes and relationships. Here’s an example (from your context):
Instead of committing nodes and relationships directly to Neo4j, capture them in memory and write them to CSV files.
Use node.as_dict() and relationship.as_dict() to ensure proper serialization of data2neo objects to CSV.
This approach allows you to use the flexibility of data2neo to transform relational data into a graph, while still being compatible with neo4j-admin import.