cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is it possible to send a CSV directly to the Neo4j python driver?

bmalbusca
Node Clone

I'm developing a GIS web application, and I have a flask backend that connects to Neo4j. Since all docs used by the user are csv, I have 2 options:

  1. Convert csv to json and send it as variable through query
  2. Create an API endpoint to access the csv (temporary saved in a variable) and then, sending the query to say Neo4j to load the resource available at that endpoint's url.

I think the max. performance can be achieved sending directly the csv file directly by the driver, similar to how it's done with json. So, I'm in this dilema, what is the best approach?

The option 1 has the drawback of converting the file and all processes that handle with json can be slower (specially in a large files). But in the option 2, I need to send a query first and only after that the Neo4j will curl the file available at the endpoint. Also, I will need to add protection to the endpoint, using tokens or uuids.

1 REPLY 1

I read about it on the Neo4j overview courses, it was basically telling that Python importation is harder to implement but faster then LOAD CSV clause.

So sending a CSV to the driver doesn't seem the way to go to me, but I can be wrong don't have so much experience on this field.

But, for the option 1, you can use the pandas module for python. It will convert the whole CSV in any format you want including json in a crasy efficient, short and easy way.

The downside is, Pandas is a little bit intense the first time.