Relational DB
Last updated
Last updated
The Relational DB tool provides access to Relational Databases. You can use SQL to query the database.
Use this tool when you need access to data stored in a relational database. If all you are doing is performing a simple select, you can leverage the Dataset tool that provides a simple abstraction over tabular data. This tool is preferable for anything that is more complex such as sub-queries or query constructs that are not supported in the Dataset tool.
A connection to the Relational DB (such as MySQL, Oracle, Postgres, etc) should already have been made in the Data Studio. You can set up a connection in the Configurations section for your database.
To create a Relational DB tool, click on Create Tool from the Tools Repository and choose Relational DB
You will get the Relational DB Tool Editor -
As with all tools provide a meaningful name and description that will help the agent understand the purpose of this tool so that the agent can use it correctly.
The configuration section is where you specify the details for a query to execute against the database.
Storage: Pick the connection you created in the Data Studio - this will provide the connection to the database server
Database: Pick the database
Query: Provide a prepared statement as your query with named parameters. The tool will convert your query into the correct prepared statement during execution. e.g. select * from my_schema.products where product_id = ${productId}
Input Parameters: Any parameters defined in the Query show up as Input parameters. Pick the type and a suitable description for it.
Output: The output of the tool should be described here
As with all tools, you can test this tool by providing values for the input parameters.