2

I'm trying to run LOAD CSV to load a file into neo4j using spring-boot-starter-data-neo4j 2.7.4. Since spring data neo4j gives me access to neo4j through the Neo4jRepository interface I can only submit queries and not call LOAD CSV. Is it possible to call LOAD CSV using spring data? Is there a way to execute raw cypher through spring data? If not how can I submit a LOAD CSV command directly to neo4j using Java?

Hunter
  • 31
  • 4

1 Answers1

1
public interface MyRepository extends Neo4jRepository<SomeObject,Long>{
    @Query("LOAD CSV FROM 'https://data.neo4j.com/bands/artists.csv' AS line\n"
            + "CREATE (:Artist {name: line[1], year: toInteger(line[2])})")
    void loadCsv();
}
Hunter
  • 31
  • 4