This PR introduces a significant update to the Toolbox configuration file format, which is one of the primary **breaking changes** required for the implementation of the Advanced Control Plane. # Summary of Changes The configuration schema has been updated to enforce resource isolation and facilitate atomic, incremental updates. * Resource Isolation: Resource definitions are now separated into individual blocks, using a distinct structure for each resource type (Source, Tool, Toolset, etc.). This improves readability, management, and auditing of configuration files. * Field Name Modification: Internal field names have been modified to align with declarative methodologies. Specifically, the configuration now separates kind (general resource type, e.g., Source) from type (specific implementation, e.g., Postgres). # User Impact Existing tools.yaml configuration files are now in an outdated format. Users must eventually update their files to the new YAML format. # Mitigation & Compatibility Backward compatibility is maintained during this transition to ensure no immediate user action is required for existing files. * Immediate Backward Compatibility: The source code includes a pre-processing layer that automatically detects outdated configuration files (v1 format) and converts them to the new v2 format under the hood. * [COMING SOON] Migration Support: The new toolbox migrate subcommand will be introduced to allow users to automatically convert their old configuration files to the latest format. # Example Example for config file v2: ``` kind: sources name: my-pg-instance type: cloud-sql-postgres project: my-project region: my-region instance: my-instance database: my_db user: my_user password: my_pass --- kind: authServices name: my-google-auth type: google clientId: testing-id --- kind: tools name: example_tool type: postgres-sql source: my-pg-instance description: some description statement: SELECT * FROM SQL_STATEMENT; parameters: - name: country type: string description: some description --- kind: tools name: example_tool_2 type: postgres-sql source: my-pg-instance description: returning the number one statement: SELECT 1; --- kind: toolsets name: example_toolset tools: - example_tool ``` --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Averi Kitsch <akitsch@google.com>
4.5 KiB
title, type, weight, description, aliases
| title | type | weight | description | aliases | |
|---|---|---|---|---|---|
| dgraph-dql | docs | 1 | A "dgraph-dql" tool executes a pre-defined DQL statement against a Dgraph database. |
|
{{< notice note >}} ⚠️ Best Effort Maintenance
This integration is maintained on a best-effort basis by the project team/community. While we strive to address issues and provide workarounds when resources are available, there are no guaranteed response times or code fixes.
The automated integration tests for this module are currently non-functional or failing. {{< /notice >}}
About
A dgraph-dql tool executes a pre-defined DQL statement against a Dgraph
database. It's compatible with any of the following sources:
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.
Note: This tool uses parameterized queries to prevent SQL injections. Query parameters can be used as substitutes for arbitrary expressions. Parameters cannot be used as substitutes for identifiers, column names, table names, or other parts of the query.
Example
{{< tabpane persist="header" >}} {{< tab header="Query" lang="yaml" >}}
kind: tools name: search_user type: dgraph-dql source: my-dgraph-source statement: | query all($role: string){ users(func: has(name)) @filter(eq(role, $role) AND ge(age, 30) AND le(age, 50)) { uid name email 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
{{< /tab >}} {{< tab header="Mutation" lang="yaml" >}}
kind: tools name: dgraph-manage-user-instance type: dgraph-dql source: my-dgraph-source isQuery: false statement: | { set { _:user1 $user1 . _:user1 $email1 . _:user1 "admin" . _:user1 "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
{{< /tab >}} {{< /tabpane >}}
Reference
| field | type | required | description |
|---|---|---|---|
| type | 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 that is passed to the LLM. |
| statement | string | true | dql statement to execute |
| isQuery | boolean | false | To run statement as query set true otherwise false |
| timeout | string | false | To set timeout for query |
| parameters | parameters | false | List of parameters that will be used with the dql statement. |