How do i make batch mutations with this client

Moved from GitHub pydgraph/109

Posted by zealot-shin:

I’d like to load lots of data into dgraph in one time with pydgraph client, is there any batch load API?

martinmr commented :

We have a live loader baked into dgraph, which is the best option but it doesn’t use the python client: https://docs.dgraph.io/deploy/#live-loader

If you want to load a lot of data before you start the cluster, you can use the bulk-loader: https://docs.dgraph.io/deploy/#bulk-loader

If you want to use the pydgraph (note that this will probably be slower than using the other options) you can create a transaction add a certain number of mutations and then commit the transaction. You’ll have to experiment to get the optimal number of mutations per transaction. I recommend 10 as a start.

But I highly recommend using either the live loader or the bulk loader as they are specifically designed for this purpose.