Neo4j is the world's leading graph database management system, designed for optimized fast management, storage, and traversal of nodes and relationships. It is a high-performance graph store with all the features expected of a mature and robust database, like a friendly query language and ACID transactions.
Apache Hop is a data engineering and data orchestration platform. Hop allows data engineers and data developers to visually design workflows and data pipelines to build powerful solutions. No other data engineering platform currently has the integration with Neo4j that Apache Hop offers.
With the following example, you will learn how to read data from a Neo4j database using Hop. If you do not have access to a Neo4j database, you can consult this quick guide of the Neo4j official documentation to run Neo4j desktop locally, or try Neo4j Aura to run Neo4j in the cloud.
As always, the examples here use a Hop project with environment variables to separate code and configuration in your Hop projects.
The Neo4j connection, specified on a project level, can be reused across multiple (instances of) a transform or other plugin types.
To create a Neo4j Connection click on the New -> Neo4j Connection option or click on the Metadata -> Neo4j Connection option.
The system displays the New Neo4j Connection view with the following fields to be configured.
The connection can be configured as in the following example:
TIP: You can find the variables used to configure the connection in the neo4j-connection.json environment file.
Test the connection by clicking on the Test button.
The Neo4j Cypher transform allows you to execute any Cypher through the Neo4j Bolt protocol using the Java driver. Both reading and writing are supported. The cypher queries can be parameterized and call procedures before returning output data.
After creating your pipeline (read-from-neo4j.hpl) add a Neo4j Cypher transform. Click anywhere in the pipeline canvas, then Search 'neo4j' -> Neo4j Cypher.
Now it’s time to configure the Neo4j Cypher transform. Open the transform and set your values as in the following example:
Tab: Options
Tab: Cypher
Tab: Returns
To preview the read data click on the Preview button.
The Text file output transform is used to export data to text file format. This is commonly used to generate Comma Separated Values (CSV files) that can be read by spreadsheet applications.
Add a Text File output transform by clicking anywhere in the pipeline canvas, then Search 'text' -> Text File output.
Now it’s time to configure the Text File output transform. Open the transform and set your values as in the following example:
Tab: File
Tab: Fields
Finally, run your pipeline by clicking on the Run -> Launch option.
The 'local' run configuration should have been created with your Hop project. If it isn't check the Hop documentation to create a pipeline run configuration.
Open the CSV file to see the read data.
You can find the samples in 5-minutes-to github repository.
Want to find out more? Download our free Hop fact sheet now!