There are a few methods for importing data into Memgraph and they cover:
How to import CSV files into Memgraph?
The easiest way to import data into Memgraph is to use the LOAD CSV Clause , which is used as a standard Cypher clause, and can be invoked straight from a running Memgraph instance.
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, and the data is loaded 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 only 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 the already imported data.
How to import streaming data from Kafka into Memgraph?
Memgraph comes with full streaming support, and you can connect Memgraph directly to a Kafka stream. Check out this guide to find out 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 your data is in the form of Cypher queries (
MERGE clauses) you can import it by using the mgconsole tool or Memgraph Lab. We refer to this format as
.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.
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.