Cannot import g01.schema.gz from terminal

Dgraph’s beginner here. This is also my first post, so pardon me if my writing isn’t clear or this question is too stupid to ask. I couldn’t tell if it’s a bug or not, but I’m trying to export data from my device and import to another (by using terminal as explained in Dgraph Tour), and one of the three files keeps failing to be imported, which is g01.schema.gz. Here is my command + log:

dgraph live -f g01.schema.gz -c 1 --format=rdf
[Decoder]: Using assembly version of decoder
I0920 13:02:00.573883   11872 init.go:102]

Dgraph version   : v20.07.1
Dgraph codename  : shuri-1
Dgraph SHA-256   : 31ad42b86244154d98ff3a468af930457a2235265965abd79481f8f74d396482
Commit SHA-1     : d7123d93e
Commit timestamp : 2020-09-17 14:57:43 -0700
Branch           : HEAD
Go version       : go1.14.4

For Dgraph official documentation, visit https://dgraph.io/docs/.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.


I0920 13:02:00.574851   11872 util_ee.go:126] KeyReader instantiated of type <nil>

Running transaction with dgraph endpoint: 127.0.0.1:9080
Found 1 data file(s) to process
Processing data file "g01.schema.gz"
Error while processing data file "g01.schema.gz": During parsing chunk in processLoadFile: while parsing line "<root>:uid . \n": while lexing <root>:uid . at line 1 column 6: Invalid input: : at lexText
During parsing chunk in processLoadFile: while parsing line "<root>:uid . \n": while lexing <root>:uid . at line 1 column 6: Invalid input: : at lexText

The two other files (g01.gql_schema.gz and g01.rdf.gz) were successfully imported. However, part of the schema is incorrect: <root>: [uid] . when it should be <root>: uid . with no array symbols.

I have already searched the whole docs, and the only thing I could find is the paragraph below which is still not clear to me.

Export will usually return 3 files: * g01.gql_schema.gz - The GraphQL schema file. This file can be reimported via the Schema APIs * g01.json.gz - the data from your instance, which can be imported via live loader * g01.schema.gz - This file is the internal Dgraph schema. If you have set up your backend with a GraphQL schema, then you should be able to ignore this file.

Source

I’m already sure the state I’m trying to import to is clean (with no schema). Should g01.schema.gz be imported in another way? Also, can you tell me the purpose of g01.gql_schema.gz because I find it not really changing anything within my data — probably because I’m using DQL instead of GraphQL.

I’m truly seeking your guidance here. :slight_smile:

Hi @medrivia,
It looks like you are importing the schema itself as nodes and predicates, which may be the cause of this bug. As per the Dgraph live loader documentation here, the command is fired as below.

 dgraph live -f <path-to-gzipped-RDf-or-JSON-file> -s <path-to-schema-file> 

The data and schema are separately provider using the -f and the -s argument respectively.

4 Likes

Ah, I see. Definitely didn’t read the docs enough. :sweat_smile:

Thank you for your assistance, @anand !