Dgraph v0.9.0 Release
The released binaries would not work with data from older versions. You can follow these instructions to upgrade Dgraph.
The latest release has a lot of breaking changes but also brings powerful features like Transactions, support for CJK and custom tokenization.
Note: Starting from this release, every read and write is done via transactions. You could run read-only transactions, read-write or write-only transactions; but there's no way to avoid transactional behavior.
Features
- Dgraph adds support for distributed ACID transactions (a blog post is in works). Transactions can be done via the Go, Java or HTTP clients (JS client coming). See docs here.
- Support for Indexing via Custom tokenizers.
- Support for CJK languages in the full-text index.
Breaking changes
Running Dgraph
- We have consolidated all the
server,zero,live/bulk-loaderbinaries into a singledgraphbinary for convenience. Instructions for running Dgraph can be found in the docs. - For Dgraph server, Raft ids can be assigned automatically. A user can optionally still specify an ID, via
--idxflag. --peerflag which was used to specify another Zero instance’s IP address is being replaced by--zeroflag to indicate the address corresponds to Dgraph zero.port,grpc_portandworker_portflags have been removed from Dgraph server and Zero. The ports are:
- Internal Grpc: 7080
- HTTP: 8080
- External Grpc: 9080 (Dgraph server only)
Users can set port_offset flag, to modify these fixed ports.
Queries
- Queries, mutations and schema updates are done through separate endpoints. Queries can no longer have a mutation block.
- Queries can be done via
QueryGrpc endpoint (it was calledRunbefore) or the/queryHTTP handler. _uid_is renamed touid. So queries now need to request foruid. Example
{
bladerunner(func: eq(name@en, "Blade Runner")) {
uid
name@en
}
}
- Facets response structure has been modified and is a lot flatter. Facet key is now
predicate|facet_name.
Examples for Go client and HTTP. - Query latency is now returned as numeric (ns) instead of string.
Recurseis now a directive. So queries withrecursekeyword at root won't work anymore.- Syntax for
countat root has changed. You need to ask forcount(uid), instead ofcount().
Mutations
- Mutations can only be done via
MutateGrpc endpoint or via/mutateHTTP handler. MutateGrpc endpoint can be used to set/ delete JSON, or set/ delete a list of NQuads and set/ delete raw RDF strings.- Mutation blocks don't require the mutation keyword anymore. Here is an example of the new syntax.
{
set {
<name> <is> <something> .
<hometown> <is> "San Francisco" .
}
}
Upsertdirective and mutation variables go away. Both these functionalities can now easily be achieved via transactions.
Schema
<*> <pred> <*>operations, that is deleting a predicate can't be done via mutations anymore. They need to be done viaAlterGrpc endpoint or via the/alterHTTP handler.- Drop all is now done via
Alter. - Schema updates are now done via
AlterGrpc endpoint or via/alterHTTP handler.
Go client
QueryGrpc endpoint returns response in JSON underJsonfield instead of protocol buffer.client.Unmarshalmethod also goes away from the Go client. Users can usejson.Unmarshalfor unmarshalling the response.- Response for predicate of type
geocan be unmarshalled into a struct. Example here. NodeandEdgestructs go away along with theSetValue...methods. We recommend usingSetJsonandDeleteJsonfields to do mutations.- Examples of how to use transactions using the client can be found at https://docs.dgraph.io/clients/#go.
Embedded Dgraph
Embedded dgraph goes away. We haven’t seen much usage of this feature. And it adds unnecessary maintenance overhead to the code.
Others
- Dgraph live no longer stores external ids. And hence the
xidflag is gone.