# Data migration

Memgraph supports multiple data sources for importing data into a running
instance. Whether your data is structured in files, relational databases, or
other graph databases, Memgraph provides the flexibility to integrate and
analyze your data efficiently.

Memgraph supports file system imports like Parquet, CSV and JSONL files, offering efficient and
structured data ingestion. **However, if you want to migrate directly from
another data source, you can use the [`migrate`
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate)** from Memgraph MAGE
for a direct transition without the need to convert your data into intermediate
files.

> **Note**
>
> In order to learn all the pre-requisites for importing data into Memgraph, check
> [import best practices](https://memgraph.com/docs/data-migration/best-practices).

> **Info**
>
> If you have a SQL data model and
> want to migrate to Memgraph, you can try out our [Agent](https://memgraph.com/docs/ai-ecosystem/agents)
> that leverages the LLM to automate the process of modeling and migration.

## File types

### Parquet files

Parquet files can be imported efficiently from the local disk and from s3:// using the
[LOAD PARQUET clause](https://memgraph.com/docs/querying/clauses/load-parquet).

### CSV files

CSV files provide a simple and efficient way to import tabular data into Memgraph 
using the [LOAD CSV clause](https://memgraph.com/docs/querying/clauses/load-csv). 

Using the [LOAD CSV import guide](https://memgraph.com/docs/data-migration/csv), 
you can implement your own CSV import through Memgraph LAB, or a simple database driver.

### JSON files

Memgraph supports importing data from JSON files, allowing structured and
semi-structured data to be efficiently loaded, using the [`json_util`
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/json_util) and [`import_util`
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/import_util).

Memgraph also support JSONL files in which every line is formatted as a separate JSON document. Such JSONL
files can be efficiently imported using the [LOAD JSONL clause](https://memgraph.com/docs/querying/clauses/load-jsonl).

Check out the [JSON import guide](https://memgraph.com/docs/data-migration/json).

### Cypherl file

Cypherl file is a simple format which defines a cypher command per line. It is
usually divided in 2 parts:
- `CREATE` statements for nodes, followed by 
- `MATCH`, `MATCH` + `CREATE` statements for relationships

An example for node creation in Cypherl would be similar to this query:
```cypher
CREATE (:Person {id: 1, name: "John", age: 18});
CREATE (:Person {id: 2, name: "Mark", age: 25});
```

While the example for relationship creation in Cypherl would be similar to this
query:
```cypher
MATCH (p1:Person {id: 1}) MATCH (p2:Person {id: 2}) CREATE (p1)-[:KNOWS]->(p2);
```

If you have existing Cypherl files defining your graph structure, Memgraph can
execute them directly to populate your database. See the [Cypherl import
guide](https://memgraph.com/docs/data-migration/cypherl).

## Database management systems

### DuckDB

Memgraph is fully compatible with all data source systems supported by DuckDB.
Using our [DuckDB migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#duckdb), you can load
data from any DuckDB-supported source, run analytical queries directly on it,
and import the results into Memgraph.

- [List of DuckDB supported data
  sources](https://duckdb.org/docs/stable/data/data_sources.html)

### MySQL

Memgraph can integrate with MySQL databases, enabling seamless migration and
real-time synchronization. Learn more about [MySQL data
import](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#mysql).

### PostgreSQL

Memgraph can integrate with PostgreSQL databases using the [PostgreSQL migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#postgresql).

### SQL Server

For enterprises using Microsoft SQL Server, Memgraph supports data import using
ETL processes or direct queries. Read the [SQL Server import
documentation](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#sql_server).

### StarRocks

Memgraph supports migration from **StarRocks** through its compatibility with
the [MySQL migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#mysql). Since
StarRocks implements a MySQL-compatible protocol, you can use the same module to
connect and migrate data into Memgraph.

### OracleDB

Memgraph can extract and import data from OracleDB, leveraging SQL queries or
external connectors. Find more details in the [OracleDB import
guide](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#oracle_db).

## Graph databases

### Neo4j

Memgraph offers a dedicated [Neo4j migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#neo4j) that allows
users to easily transition from Neo4j. By connecting to an existing Neo4j
instance, you can migrate your entire graph to Memgraph using a single Cypher
query.

- [Step-by-step guide to migrate from Neo4j using a single Cypher
  query](https://memgraph.com/docs/data-migration/migrate-from-neo4j-using-single-cypher-query)

### Memgraph

The fastest way to migrate from one Memgraph instance to another is by using
[snapshot recovery](https://memgraph.com/docs/database-management/backup-and-restore#restore-data), which
leverages Memgraph’s proprietary durability files for efficient data backup and
restore. This process can be parallelized during startup for even faster
recovery.

If you only want to migrate a portion of your data, Memgraph also provides a
[Memgraph migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#memgraph) that allows
selective migration between Memgraph instances.

We also provide guides to migrate from Neo4j using a CSV file or by using a
single Cypher query:

- [Migrate from Neo4j](https://memgraph.com/docs/data-migration/migrate-from-neo4j) 
- [Migrate from Neo4j using a single Cypher query](https://memgraph.com/docs/data-migration/migrate-from-neo4j-using-single-cypher-query)

## RPC Protocols

### Arrow Flight

Memgraph supports migration from any system that uses **Arrow Flight** as its
RPC protocol for fast and efficient data transfer. The [Arrow Flight migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#arrow_flight) enables
you to stream data directly into Memgraph.

## Streaming Sources

### Apache Kafka

Memgraph offers [native integration with **Apache
Kafka**](https://memgraph.com/docs/data-streams#kafka-and-redpanda), enabling real-time data streaming
directly into the graph. It includes built-in Kafka consumers for easy setup and
processing of incoming data streams.

For more advanced setups, users can [integrate with **Kafka
Connect**](https://memgraph.com/docs/data-streams/kafka) or build custom consumers using [Memgraph client
libraries](https://memgraph.com/docs/client-libraries) available in multiple programming languages.

### Apache Pulsar

Memgraph offers [native integration with **Apache
Pulsar**](https://memgraph.com/docs/data-streams#pulsar), enabling real-time data streaming directly into
the graph. It includes built-in Pulsar consumers for easy setup and processing
of incoming data streams.

For more advanced setups, users can build custom consumers using [Memgraph
client libraries](https://memgraph.com/docs/client-libraries) available in multiple programming
languages.

### Apache Spark

Memgraph is compatible with the **Neo4j Spark Connector**, which makes it easy
to integrate Spark-powered pipelines with Memgraph. You can use this connector
to process large-scale data in Spark and ingest the results directly into
Memgraph for real-time graph analytics.

- [Step-by-step guide to migrate with Apache
  Spark](https://memgraph.com/docs/data-migration/migrate-with-apache-spark)

### Dremio

Memgraph supports migration from the **Dremio** query engine using the [Arrow
Flight RPC
protocol](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#arrow_flight), which
enables high-performance data transfer from data lakes and lakehouses. You can
use Dremio to query formats like Apache Iceberg and stream the results directly
into Memgraph.

- [Guide to migrate Iceberg tables from a data lake using
  Dremio](https://memgraph.com/docs/data-migration/migrate-iceberg-tables-from-data-lake-using-dremio)

## Data platforms

### ServiceNow

Memgraph supports the [migration module from
ServiceNow](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#servicenow)
through its dedicated migration module. By connecting to the **ServiceNow REST
API**, the module enables you to retrieve and ingest data directly into Memgraph
for further analysis and visualization.

## Storage services

### Amazon S3

Memgraph supports data migration from **Amazon S3** and other **S3-compatible
storage services**. Using the [S3 migration
module](https://memgraph.com/docs/advanced-algorithms/available-algorithms/migrate#s3), you can load
structured data stored in cloud object storage directly into Memgraph for
graph-based processing and analysis.

## Other

### Data from an application or a program

Memgraph offers a [wide range of client libraries](https://memgraph.com/docs/client-libraries) that can
be used to connect directly to the platform and import data.

### Parquet, ORC or IPC/Feather/Arrow file

If you are a Python user you can import Parquet, ORC or IPC/Feather/Arrow file
into Memgraph using
[GQLAlchemy](https://memgraph.github.io/gqlalchemy/how-to-guides/loaders/import-table-data-to-graph-database/).

Parquet files migration are also supported with the [DuckDB migration](#duckdb).

### NetworkX, PyG or DGL graph

If you are a Python user you can import NetworkX, PyG or DGL graph into Memgraph
using [GQLAlchemy](https://memgraph.github.io/gqlalchemy/how-to-guides/translators/import-python-graphs/).

## Need help with data migration?

Schedule a 30 min session with one of our engineers to discuss how Memgraph fits
with your architecture. Our engineers are highly experienced in helping
companies of all sizes to integrate and get the most out of Memgraph in their
projects. Talk to us about data modeling, optimizing queries, defining
infrastructure requirements or migrating from your existing graph database. No
nonsense or sales pitch, just tech.

![](https://memgraph.com/docs/pages/getting-started/memgraph-office-hours.svg)

- [Book a call](https://memgraph.com/office-hours)
