Hello everyone,
I am hitting a wall with Slash GraphQL that I am hoping somebody with a little bit more experience can help me find a way around.
I am developing a series of importers from a python jupyter notebook using the pydgraph
library. My importer gets a data point from a csv file does some processing and augmentation and then stores it in Dgraph using DQL (I believe that’s what the python API implements).
In my Slash > Settings > Advanced
I have set the Backend Mode
to be Flexible
because according to this documentation (https://dgraph.io/docs/slash-graphql/admin/backend-modes/) it would allow me to run DQL queries without having any schema restrictions. No schema restrictions is what made me love graph-based databases to begin with.
My importer sends mutations in the form of so-called blank nodes that look like this:
{'uid': '_:deposit80031',
'dgraph.type': 'Deposit',
'type': 'book',
'subtype': 'monograph',
'title': 'Krzysztof Wodiczko - Public address',
'code': 'wodi-k-2',
'institution': {'uid': '_:institution48025',
'dgraph.type': 'Institution',
'name': 'Some name'}}
Each blank node has a dgraph.type
attribute. My Slash backend seems to take this without a problem and there are no errors at all during the import. After the import is complete I don’t see my data anywhere in the Data Visualizer
, nothing at all. However if I run a DQL query in Slash I see that my data is there. I just can’t seem to be able to use it from the GraphQL interface to DGraph.
One of the most important selling points of dgraph for my use case is the ability to work schema free and to have nodes that are not necessarily uniform in k-v attributes. By this I mean for example that I can have a Book node that looks like this:
{
'uid': '_:book',
'dgraph.type': 'Book',
'title': 'Some title',
}
and another second node that looks like this:
{
'uid': '_:book',
'dgraph.type': 'Book',
'title': 'Some other title',
'isbn':'1234567890ABC',
'isbn13': '1234567890ABC',
'published' : 1992
}
This flexibility is just what I need in my use case.
And one of the best selling points for my front-enders is the ability to use GraphQL for data-fetching. But I can’t seem to find a way to reconcile these workflows within dgraph Slash. Once I corset my data into a schema, I lose the flexibility of defining odd-ball nodes with attributes that I need there, having another node called metadata
seems to defeat the purpose of a graph database and brings traumatic memories of using attribute tables in RDBMs.
Has anybody here found a way to make the dgraph.type
node types visible from Slash’s GraphQL schema or data visualization tools? Is the workflow I am attempting even possible in dgraph? Does anybody have any advice on how I could go about this differently?
Thanks in advance.