-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
497fb06
commit ff5c846
Showing
12 changed files
with
1,063 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: "Dgraph" | ||
type: docs | ||
description: > | ||
Dgraph is a horizontally scalable and distributed graph database. | ||
--- | ||
|
||
## About | ||
|
||
[Dgraph][dgraph-docs] is a horizontally scalable and distributed graph database. | ||
It provides ACID transactions, consistent replication, and linearizable reads. | ||
|
||
This source can connect to either a self-managed Dgraph cluster or one hosted on Dgraph Cloud. | ||
If you're new to Dgraph, the fastest way to get started is to [sign up for Dgraph Cloud][dgraph-login]. | ||
|
||
[dgraph-docs]: https://dgraph.io/docs | ||
[dgraph-login]: https://cloud.dgraph.io/login | ||
|
||
## Requirements | ||
|
||
### Database User | ||
|
||
When **connecting to a hosted Dgraph database**, this source uses the API key for access. If you are using a dedicated environment, you will additionally need the namespace and user credentials for that namespace. | ||
|
||
For **connecting to a local or self-hosted Dgraph database**, use the namespace and user credentials for that namespace. | ||
|
||
## Example | ||
|
||
```yaml | ||
sources: | ||
my-dgraph-source: | ||
dgraphUrl: "https://xxxx.cloud.dgraph.io" | ||
user: "groot" | ||
password: "password" | ||
apiKey: abc123 | ||
namepace : 0 | ||
``` | ||
## Reference | ||
| **Field** | **Type** | **Required** | **Description** | | ||
|-------------|:--------:|:------------:|--------------------------------------------------------------------------------------------------| | ||
| kind | string | true | Must be "dgraph". | | ||
| dgraphurl | string | true | Connection URI (e.g. "https://xxx.cloud.dgraph.io", "https://localhost:8080"). | | ||
| user | string | false | Name of the Dgraph user to connect as (e.g., "groot"). | | ||
| password | string | false | Password of the Dgraph user (e.g., "password"). | | ||
| apiKey | string | false | API key to connect to a Dgraph Cloud instance. | | ||
| namespace | uint64 | false | Dgraph namespace (not required for Dgraph Cloud Shared Clusters). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Dgraph DQL Tool | ||
|
||
|
||
A "dgraph-dql" tool executes a pre-defined DQL statement against a Dgraph database. It's compatible with any of the following | ||
sources: | ||
- [dgraph](../sources/dgraph.md) | ||
|
||
To run a statement as a query, you need to set the config isQuery=true. For upserts or mutations, set isQuery=false. | ||
You can also configure timeout for a query. | ||
|
||
## Example | ||
|
||
### Query: | ||
|
||
```yaml | ||
tools: | ||
search_user: | ||
kind: dgraph-dql | ||
source: dgraph-user-instance | ||
statement: | | ||
query all($role: string){ | ||
users(func: has(name)) @filter(eq(role, $role) AND ge(age, 30) AND le(age, 50)) { | ||
uid | ||
name | ||
role | ||
age | ||
} | ||
} | ||
isQuery: true | ||
timeout: 20s | ||
description: | | ||
Use this tool to retrieve the details of users who are admins and are between 30 and 50 years old. | ||
The query returns the user's name, email, role, and age. | ||
This can be helpful when you want to fetch admin users within a specific age range. | ||
Example: Fetch admins aged between 30 and 50: | ||
[ | ||
{ | ||
"name": "Alice", | ||
"role": "admin", | ||
"age": 35 | ||
}, | ||
{ | ||
"name": "Bob", | ||
"role": "admin", | ||
"age": 45 | ||
} | ||
] | ||
parameters: | ||
- name: $role | ||
type: string | ||
description: admin | ||
``` | ||
### Mutation: | ||
```yaml | ||
tools: | ||
dgraph-manage-user-instance: | ||
kind: dgraph-dql | ||
source: dgraph-manage-user-instance | ||
isQuery: false | ||
statement: | | ||
{ | ||
set { | ||
_:user1 <name> $user1 . | ||
_:user1 <email> $email1 . | ||
_:user1 <role> "admin" . | ||
_:user1 <age> "35" . | ||
_:user2 <name> $user2 . | ||
_:user2 <email> $email2 . | ||
_:user2 <role> "admin" . | ||
_:user2 <age> "45" . | ||
} | ||
} | ||
description: | | ||
Use this tool to insert or update user data into the Dgraph database. | ||
The mutation adds or updates user details like name, email, role, and age. | ||
Example: Add users Alice and Bob as admins with specific ages. | ||
parameters: | ||
- name: $user1 | ||
type: string | ||
description: Alice | ||
- name: $email1 | ||
type: string | ||
description: alice@email.com | ||
- name: $user2 | ||
type: string | ||
description: Bob | ||
- name: $email2 | ||
type: string | ||
description: bob@email.com | ||
``` | ||
## Reference | ||
| **field** | **type** | **required** | **description** | | ||
|-------------|----------:|:------------:|----------------------------------------------------------------------------------------------------| | ||
| kind | string | true | Must be "dgraph-dql". | | ||
| source | string | true | Name of the source the dql query should execute on. | | ||
| description | string | true | Description of the tool | | ||
| statement | string | true | dql statement to execute | | ||
| isQuery | boolean | false | To run statment as query set true otherwise false | | ||
| timeout | string | false | To set timout for query | | ||
| parameters | parameter | true | List of [parameters](README.md#specifying-parameters) that will be used with the dql statement. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.