# Convert of "USING PERIODIC COMMIT" to a "CALL" with LOAD CSV

**URL:** <https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633>\
**Category:** Neo4j Graph Platform\
**Tags:** migrated\
**Created:** [September 29, 2022, 9:28am UTC](https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633 "2022-09-29T09:28:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kasipasi](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kasipasi](https://community.neo4j.com/u/kasipasi)\
**Post date:** [September 29, 2022, 9:28am UTC](https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633/1 "2022-09-29T09:28:26Z")

</div>

This code does the job, but it looks like this method will be deprecated soon. Should use CALL function instead.

I'm a neo4j baby.. Can anyone point me in right direction on how to convert a

"USING PERIODIC COMMIT" to a "CALL"

```auto
// IMPORT ECLASS
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///eclass12-EN.csv' AS row
MERGE (e:Eclass { standard: row.Standard, versionNumber: row.VersionNumber, isoLanguageCode: row.ISOLanguageCode, codedName: row.CodedName, idcc:row.IdCC, preferredName: row.PreferredName, definition: COALESCE(row.Definition, ''), mkKeyword: COALESCE(row.MKKeyword, ''), irdicc: row.IrdiCc });

```

![kasipasi_1-1664443560094.png](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/1/e/1ef48d8f4b20087dcf71ab29c7125ff51330e39f.png "kasipasi\_1-1664443560094.png")

---

<div class="post-metadata">

**Author:** ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)\
**Post date:** [September 29, 2022, 9:39am UTC](https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633/2 "2022-09-29T09:39:57Z")

</div>

You can find more details [here](https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/#subquery-call-in-transactions). Moreover, you should only put the property that bears the constraint in the MERGE clause and other properties should be set in the SET clause.

```auto
LOAD CSV WITH HEADERS FROM 'file:///eclass12-EN.csv' AS row 
CALL {
    WITH row
    MERGE (e:Eclass {idcc:row.IdCC}) 
    SET e += {
        standard: row.Standard, 
        versionNumber: row.VersionNumber, 
        isoLanguageCode: row.ISOLanguageCode, 
        codedName: row.CodedName, 
        preferredName: row.PreferredName, 
        definition: COALESCE(row.Definition, ''), 
        mkKeyword: COALESCE(row.MKKeyword, ''), 
        irdicc: row.IrdiCc 
    }
} IN TRANSACTIONS OF 1000 ROWS;

```

Regards,  
Cobra

---

<div class="post-metadata">

**Author:** ![kasipasi](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kasipasi](https://community.neo4j.com/u/kasipasi)\
**Post date:** [September 29, 2022, 10:06am UTC](https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633/3 "2022-09-29T10:06:25Z")

</div>

Hi Cobra,

Thank you for your swift reply! 🙂 I'm getting this error.

A query with 'CALL { ... } IN TRANSACTIONS' can only be executed in an implicit transaction, but tried to execute in an explicit transaction.

I tried this and it worked, but not sure what method is best to you. I will be importing 200k records soon form a CSV file so I would like to understand what is best pratice. 🙂

```auto
:auto LOAD CSV WITH HEADERS from 'file:///eclass12-EN-50.csv' AS row
CALL {
    with row
MERGE (e:Eclass { standard: row.Standard, versionNumber: row.VersionNumber, isoLanguageCode: row.ISOLanguageCode, codedName: row.CodedName, idcc:row.IdCC, preferredName: row.PreferredName, definition: COALESCE(row.Definition, ''), mkKeyword: COALESCE(row.MKKeyword, ''), irdiCc: row.IrdiCC })
}
IN TRANSACTIONS OF 10 ROWS;

```

---

<div class="post-metadata">

**Author:** ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)\
**Post date:** [September 29, 2022, 10:19am UTC](https://community.neo4j.com/t/convert-of-using-periodic-commit-to-a-call-with-load-csv/59633/4 "2022-09-29T10:19:03Z")

</div>

For CSV files with less than 10 million records, you can use the LOAD CSV. Moreover, you should have a query to create nodes and another one to create relationships. Don't forget to create [UNIQUE CONSTRAINTS](https://neo4j.com/docs/cypher-manual/current/constraints/) before loading nodes.

If you want to load larger datasets, you will have to look at [bulk import](https://neo4j.com/docs/operations-manual/current/tools/neo4j-admin/neo4j-admin-import/).
