JSON bulk loading error - Data path() does not exist


(Chirag) #1

I am trying to bulk load JSON data to Dgraph using command line.

I tried the few approaches/commands and none of them worked for me. It kept on giving me the below error.
"Data path() does not exist"

Commands I tried:

  1. dgraph bulk --jsons=“loader.json” -s loader.schema
  2. dgraph bulk --jsons=“loader.json” -s loader.schema --http localhost:8084 --zero=localhost:7084
  3. dgraph bulk --jsons="./json" -s loader.schema
  4. dgraph bulk --jsons="./json/loader.json" -s loader.schema
    and many more combinations…

But every time it would return the same error: “Data path() does not exist”

On checking the source code, it seems that “jsons” option is not handled properly and “jsonDir” path is never checked, and only rdfDir is checked. This seems to be one probable reason for this.

Can anyone help me with this?


(Ami Pandat) #2

Hey, Chirag
I was facing same error!
But at that time I have done one mistake that I have started alpha and ratel first and then loaded bulk loader but for bulk loader steps are like
1 you have to start dgraph zero
2 Bulk loader
3 run dgraph alpha
4 Ratel
You can try this from scratch and your 2nd combination

:point_up_2: This will work successfully,I suppose.

And whenever you want to start from scratch just delete \p and \w directory and then load command again. This worked for me.

Cheers!


(Chirag) #3

Hi Ami,

Just like you suggested, I deleted \p and \w directory first.
Then started Dgraph zero and ran the bulk load command, but encountered the same error again, “Data path() does not exist”

By Bulk loader (Step 2 in your previous reply), what do you mean? The command or something else?

Has it got something to do with the port number?


(Ami Pandat) #4

yaa command.

Well, just verify that your http port is same which you use for localhost [ I mean for ratel console]


(Ami Pandat) #5

Did you check your currrent directory? I mean where you load your dgraph and where you have stored your json file …are they on same directory?


(Chirag) #6

Hi Ami,

Even tried running, by keeping it at the same level and followed the steps as in your first reply.
Still no luck!

Also, what exactly is expected in the --http param? Just rechecking it with you.

Are you sure the bulk load works properly for JSON(–jsons)?
Because when trying the rdf command(-r), it never gives me the “Data path() does not exist” error


(Ami Pandat) #7

Not sure. Because when I tried second time it didn’t work[but there was a need to clean my dataset also…so…I don’t know an exact error] and I shifted to use rdf.

Yes…with rdf it works fine.

@MichelDiz May be you know better than me. As I have just started with this!

Port of your local host where you load your console.


(Michel Conrado) #8

I’ve saw this before.

Well the issue was that the user was using Dgraph installed globally. But He was trying to use a local binary. I think this happens because the global binary lost his path context. Not sure about this, but happend only on some Linux Dist.

Use the flag --cwd to set your path manually on Dgraph.

dgraph bulk --cwd=/yourPathTo/dgraph/ --jsons="." --zero=addr:5080 (...)

If not so, share your version. Tell-me if you installed it by script or binary or docker or something else. Check “whoami” to see if you have rights.

let me know if it works.

Update

–cwd doesn’t exist in some binaries. If you need it build Dgraph from master (but pay attention that master isn’t ready to regular use. Due it’s in constant development).

Other possible mistake is when the user has Dgraph installed globally and really wanna use a local binary (build or downloaded). So in this case you have to start Dgraph as ./dgraph bulk right in the exact path that the bin exists and also the JSON.


(Javier Alvarado) #9

This would indicate that the bulk command can’t find the data file “loader.json”. It expects to find it in the same directory dgraph bulk is running from.

Also, which version of dgraph are you using? You can find out by running dgraph version.