janardhan
(janardhan reddy)
January 31, 2017, 4:15am
1
We want to go away with specifying a schema file and find out the schema of the predicate on run time (during first mutation).
For now we can store the schema at predicate level. Query to find out the schema of a predicate would look like
{
schema(pred: "film.actor.film") {
pred,
type
}
}
which would return(we can’t return name of object type as of now)
{
"schema": {
"pred": "film.actor.film",
"type": "uid"
}
}
{
schema(pred: "film.actor.date_of_birth") {
pred,
type
}
}
{
"schema":{
"pred": "film.actor.date_of_birth",
"type": "DateTime"
}
}
Query to fetch all predicates.
{
schema {
pred,
type
}
}
{
"schema":[ {
"pred": "film.actor.date_of_birth",
"type": "DateTime"
},{
"pred": "film.actor.film",
"type": "uid"
}
]
}
1 Like
F21
(Francis Chuang)
March 10, 2017, 12:24am
3
I was playing around with dgraph today and found that having to include a schema file to start the server makes operations a bit cumbersome.
After going through the docs, I noticed that it is possible to define a type when creating a mutation, so that the schema won’t be needed. I opened an issue to store the schema within the cluster (Ability to store the schema on cluster · Issue #685 · dgraph-io/dgraph · GitHub ) which might be related to this.
However, it appears that in order to use indexing, that will need to be defined in a schema. Are there any plans to deal with this problem, so it might be possible to use dgraph indexing without a schema in the future?
Hi @F21 ,
We’re already storing the schema withing Dgraph (Schema file is just something to start with). The types are inferred from the mutation (if not specified in schema). We’re working on allowing mutations to schema itself (Adding an index to a predicate, etc) and you can expect it with the next release.
Thanks!
1 Like
matthiasg
(Matthias Goetzke)
April 6, 2017, 7:13am
5
@ashwin95r is there a general timeline for a release that allows dynamic schema generation ?
janardhan
(janardhan reddy)
April 6, 2017, 7:19am
6
@matthiasg : It’s been included in latest release
matthiasg
(Matthias Goetzke)
April 6, 2017, 7:44am
7
? That was fast. Will have a look at it then. Thanks !
1 Like
janardhan
(janardhan reddy)
Closed
November 28, 2017, 12:59am
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.