# Creating dynamic nodes with csv upload, doesn't work?

**URL:** <https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965>\
**Category:** Cypher\
**Tags:** cypher, load-csv\
**Created:** [December 22, 2024, 7:56am UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965 "2024-12-22T07:56:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![syolbe1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/syolbe1/32/32796_2.png) [@syolbe1](https://community.neo4j.com/u/syolbe1)\
**Post date:** [December 22, 2024, 7:56am UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965/1 "2024-12-22T07:56:58Z")

</div>

I am uploading a csv file, and tried to generate the nodes with labels that are defined in the csv, i.e. dynamically:

```auto
LOAD CSV WITH HEADERS FROM 'nodes.csv' AS row  
MERGE (n:$(row.node_type) {id: row.id});

```

but I get this error:

```auto
Neo.ClientError.Statement.SyntaxError

Invalid input '

```

I am using the example from the doc:

> **[LOAD CSV - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/)**
>
> \`LOAD CSV\` is used to import data from CSV files into a Neo4j database.

 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/7/5/75498fe6efb59d6abc9da7f7789014abed74f6f1.png): expected a node label/relationship type name, '%' or '(' (line 3, column 14 (offset: 92)) " MERGE (n:$(row.node\_type) {id: row.id});"

```auto

I am using the example from the doc:
https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/

![image](upload://gJzt9gvSrs1PXgQ0fvTZug1HoIN)
```

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [December 22, 2024, 12:48pm UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965/2 "2024-12-22T12:48:38Z")

</div>

Do you have the latest version, as this is when it was released?

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [December 22, 2024, 5:55pm UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965/3 "2024-12-22T17:55:29Z")

</div>

@syolbe1

dynamic labels were introduced in Neo4j 5.26.  
Also although you can use dynamic labels on cypher statements you should be aware that there is a performance consideration

> **[MERGE - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/clauses/merge/#dynamic-merge-caveats)**
>
> The \`MERGE\` clause ensures that a pattern exists in the graph.

---

<div class="post-metadata">

**Author:** ![syolbe1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/syolbe1/32/32796_2.png) [@syolbe1](https://community.neo4j.com/u/syolbe1)\
**Post date:** [December 22, 2024, 10:26pm UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965/4 "2024-12-22T22:26:54Z")

</div>

I see, thanks for the quick feedback !

---

<div class="post-metadata">

**Author:** ![syolbe1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/syolbe1/32/32796_2.png) [@syolbe1](https://community.neo4j.com/u/syolbe1)\
**Post date:** [December 22, 2024, 10:55pm UTC](https://community.neo4j.com/t/creating-dynamic-nodes-with-csv-upload-doesnt-work/71965/5 "2024-12-22T22:55:29Z")

</div>

@glilienfield @dana_canzano  
indeed it works with 5.26. 👍
