app icon
database
0.0.6

This tool is used to execute SQL and text2sql in an existing database.

hjlarry/database14788 installs

database

Author: hjlarry
Version: 0.0.5
Type: tool
Repo: https://github.com/hjlarry/dify-plugin-database
Feature Request: issues
中文文档 README_CN.md

Be Carefull!

The sql_execute tool can run any SQL query; for enhanced security, always use a read-only database account.

Description

A database tool make it easy to query data from existing databases.

You can get different format of data, like , , , , , etc. Also support use a url to get those data.

Usage

1. Input a databaseURI for Authorization. Now support , , , , , example format:

Note:: this plugin always run in a docker, so the always means docker internal network, try instead.

2. Use the tool to query data from the database.


The is used to specify the format of the output data. If you don't specify it, the default format is and will output in the variable of workflow node. will output in the variable, other format will create file and output in the variable.

If you input the field, it will overwrite the default authorization uri, so this will be useful if you want to use different databases in the same workflow.

3. Use the tool can transform user input to a valid sql query.

This tool will use the default prompt here to generate a sql query. If you specify the field, it will only get those tables' schema into the LLM context.

4. Use the tool can get the schema of tables.

If the tool can't generate a helpful sql query, you can use this tool to get the schema of tables, then use the schema orginze with your own prompt or other information to a LLM node to generate a helpful sql query.

5. The tool can execute a sql query from a csv file.


The table name is always , the column name is the csv file's first line. It support output and .

6. Use the tool to get the data from a url request.

example url request format:

Changelog

0.0.6

  1. support get more table info of tool
  2. support special of tool

0.0.5

  1. support in sql query
  2. fix generate double quotes sql string
  3. fix
  4. add connect option of sqlalchemy
  5. change the of authorization to an optional field
  6. add a to directly response the schema of tables
  7. add a tool to execute a sql query from a csv file
  8. fix authorization can't run

0.0.4

  1. support , connection
  2. change to a llm format, so that user can use a environment variable of workflow to set the database uri
  3. fix in a agent app, tool only response the first result
  4. migrate the table schema info of the tool to a user prompt, to prevent system prompt too long then response nothing

0.0.3

  1. add to requirements.txt to support mysql 8.1 sha256 link
  2. remove database uri setting of the endpoint
  3. add a to support link to multiple databases
  4. change the of sql_execute tool to a form format
  5. change the of text2sql tool to a llm format
  6. fix sql query being converted to lowercase issue

Contact

CATEGORY
Tool
VERSION
0.0.6
hjlarry·04/29/2025 06:45 AM
REQUIREMENTS
LLM invocation
Tool invocation
Endpoint registration
Maximum memory
256MB