> ## Documentation Index
> Fetch the complete documentation index at: https://turingdb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Import a JSONL file

> Load a JSONL graph file into TuringDB using the LOAD JSONL command

TuringDB natively imports JSONL files through the `LOAD JSONL` command. The expected format is compatible with **Neo4j APOC's JSON export** (produced by `apoc.export.json.all` with `useTypes:true`).

> [!TIP]
>
> If you are migrating from Neo4j, you do not need to write this file by hand — see the [Neo4j import guide](https://turingdb.mintlify.site/import_data/neo4j.md).

## Expected file format

Each line is a self-contained JSON object representing either a node or a relationship:

```json theme={null}
{"type":"node","id":"0","labels":["Person"],"properties":{"name":"Alice","age":30}}
{"type":"node","id":"1","labels":["Person"],"properties":{"name":"Bob","age":25}}
{"type":"node","id":"2","labels":["Company"],"properties":{"name":"Acme Corp"}}
{"type":"relationship","id":"0","label":"KNOWS","start":{"id":"0"},"end":{"id":"1"},"properties":{"since":2021}}
{"type":"relationship","id":"1","label":"WORKS_AT","start":{"id":"0"},"end":{"id":"2"}}
```

**Nodes** (`"type": "node"`):

| Field | Requirement |
| - | - |
| `type` | Must be the string `"node"` |
| `id` | Required. Integer or string parseable as integer. Must start at `0` and increment by `1` with no gaps. |
| `labels` | Required. Array with at least one label. |
| `properties` | Optional. Dictionary with property keys and values. |

**Relationships** (`"type": "relationship"`):

| Field | Requirement |
| - | - |
| `type` | Must be the string `"relationship"` |
| `id` | Required. Integer or string parseable as integer. Must start at `0` and increment by `1` with no gaps. |
| `label` | Required. Exactly one label. |
| `start` / `end` | Required. Either: - a bare integer (or string parseable as integer) referencing a node `id` - a dictionary with an `id` key holding an integer (or string parseable as integer) referencing a node `id`. |
| `properties` | Optional. Dictionary with property keys and values. |

## Loading embedding properties

By default, an array-valued property in the JSONL is stored as a string. To load specific array properties as **embeddings** (type `Embedding`, usable with `cosine_similarity` / `euclidean_distance`), append a `WITH EMBEDDINGS` clause listing each embedding property and its dimension:

```jsx theme={null}
LOAD JSONL 'mydata.jsonl' AS mygraph WITH EMBEDDINGS [{"embedding", 384}, {"summary_vec", 768}]
```

Each spec is `{"<property name>", <dimension>}`. The dimension must be **greater than 1**, and every array under that property must have exactly that many numeric elements (otherwise the load fails). This works for both node and relationship properties. Array properties not listed in `WITH EMBEDDINGS` are still stored as strings.

> [!NOTE]
>
> This sets embeddings as node/edge **properties**. To bulk-load embeddings onto an *existing* graph from a Parquet file, use [`LOAD EMBEDDING FROM`](https://turingdb.mintlify.site/vector-search#embeddings-as-node-properties) instead.

## Import steps

**1. Place your file in the TuringDB data directory**

TuringDB only reads external files from the `data` subdirectory of its working directory (set by `-turing-dir`, default `$HOME/.turing`).

```bash theme={null}
cp mydata.jsonl ~/.turing/data/
```

**2. Load the file into a new graph**

> [tab] Cypher
>
> ```jsx theme={null}
> LOAD JSONL 'mydata.jsonl' AS mygraph
> ```

> [tab] Python SDK
>
> ```python theme={null}
> from turingdb import TuringDB
>
> client = TuringDB(host="http://localhost:6666")
> client.query("LOAD JSONL 'mydata.jsonl' AS mygraph")
> ```

TuringDB creates a new graph named `mygraph` and populates it with all nodes and relationships from the file.

**3. Set the graph as active and query it**

> [tab] Cypher
>
> ```jsx theme={null}
> cd mygraph
>
> MATCH (n) RETURN n
> ```

> [tab] Python SDK
>
> ```python theme={null}
> client.set_graph("mygraph")
>
> df = client.query("MATCH (n) RETURN n")
> print(df)
> ```

> [!TIP]
>
> Your JSONL data is now loaded and queryable as a TuringDB graph.

## Verify the import

Use procedures to inspect what was imported:

> [tab] Cypher
>
> ```jsx theme={null}
> CALL db.labels()
> CALL db.edgeTypes()
> CALL db.propertyTypes()
> ```

> [tab] Python SDK
>
> ```python theme={null}
> print(client.query("CALL db.labels()"))
> print(client.query("CALL db.edgeTypes()"))
> print(client.query("CALL db.propertyTypes()"))
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.