There are a few methods for importing data into Memgraph and they cover:
How to import CSV files into Memgraph?
The easiest option for importing data into Memgraph is the LOAD CSV Clause which can be invoked straight from a running Memgraph instance and is used as a standard Cypher clause.
How to import streaming data from Kafka into Memgraph?
Memgraph comes with full streaming support, and you can connect directly to a Kafka stream. Check out this guide on how to connect to a Kafka stream and take a look at the examples with different serialization mechanisms:
How to migrate data from a relational database?
How to import data from Cypher queries?
If you have data in the form of Cypher queries (
MERGE clauses) you can import it by using the mgconsole tool or Memgraph Lab. We call this format
.cypherl and you can find an example of how to import such data here.
How to import data directly from an application/program?
Memgraph offers a wide range of drivers that can be used to connect directly to the platform. You can find a list of all the supported connection methods here.
How to create a snapshot from CSV files?
The CSV Import Tool allows you to import nodes and relationships from multiple CSV files at once. The import is done while Memgraph is not running, so it can load the data the next time it starts. The tool is fully compatible with the Neo4j CSV format. If you already have a pipeline set-up for Neo4j, you should only replace
neo4j-admin import with
mg_import_csv. Keep in mind that the CSV Import Tool creates one snapshot from the supplied CSV files. Memgraph will overwrite any present data with the newly created snapshot. This means that additional imports need to be done with the LOAD CSV Clause if you want to preserve already imported data.
Where to next?
To learn more about the Cypher language, visit the Cypher manual or Memgraph Playground for interactive guides. For real-world examples of how to use Memgraph, we strongly suggest going through one of the available Tutorials. Details on what can be stored in Memgraph can be found in the article about Data storage.