What data does your users.json file contain? The file has to contain data in the correct format like User.id, User.followees, User.username and so on for data to be written correctly. If it doesn’t have the prefix, then Dgraph will store whatever it has.
Giving the GraphQL schema while doing bulk loading via -g schema.graphql just stores the GraphQL schema inside the Dgraph instance so that when you bring up the instance you have an API that you can hit.
@pawan i fixed the users.json file as you mentioned, and now the fields has correct names.
but it seems that the schema itself is not registered inside Dgraph instance, as there is no index on them:
here is the simplified versions of schema and data files: schema_simple.graphql (106 Bytes) and users_simple.json (233 Bytes)
which can be used with this command to reproduce the bug:
Thanks @mbande for providing the data files. I was able to reproduce the issue.
Inside users_simple.json file, dgraph.type attribute has not been set which is resulting in this behaviour. You need to explicitly set the dgraph.type attribute so that DQL or GraphQL queries could get to know type of a node.
I added dgraph.type attribute to the two entities as follows
also, because there is no schema and hence no uniqueness constraint at the bulk load time, there are many duplicate nodes in database.
sample file to reproduce: users_simple.json (348 Bytes)
Thanks for providing with the updated json file. I was able to reproduce this issue.
Bulk Loader is meant to be used for loading large data into a new Dgraph cluster. The data is provided in json/rdf format using the -f flag. By providing the graphql schema with -g flag, the related graphql mutations and queries are generated which could then be used to query or mutate data.
But, the provided graphql schema is not used to create corresponding DQL types. This is done so as to avoid conflicts with the existing DQL types. To do that, you may use the /admin/schema graphql endpoint after using bulk loader for the correct DQL schema to reflect on ratel.
There are differences between GraphQL and DQL schemas. One of the difference is the @id directive in GraphQL which does not directly translate to a DQL schema. The problem of no uniqueness constraint is caused due to this. A possible workaround for this is to start an empty Dgraph cluster with the given GraphQL schema and then insert data using GraphQL endpoint. Although, this will be slower than bulk loader.