ChatBI, built on Dify on Data Management (DMS) and natural language to SQL (NL2SQL), redefines data analytics. ChatBI uses AI tools to understand user questions and respond in natural language. It then uses NL2SQL to convert natural language to SQL. Dify executes the SQL and displays the results as visualizations. This solution extends data analytics to your entire organization, speeds up business responses, and helps you easily gain data insights.
Prerequisites
You have successfully deployed Dify.
Your Dify on DMS is running version V1.4.3 or later. For more information, see View the Dify version.
Step 1: Install the AliyunDMS plugin required by ChatBI
- Log on to the DMS console V5.0.
Go to the Workspace Management page.
You can choose one of the following methods to go to the workspace based on your requirements:
Method 1
Move the pointer over the
icon in the upper-left corner and choose .NoteIf you use the DMS console in normal mode, choose in the top navigation bar.

Method 2
In the left-side navigation pane, click the
icon and then click Workspace.NoteIf you use the DMS console in normal mode, choose in the top navigation bar.
Click the name of the target workspace.
In the left-side navigation pane, choose .
In the upper-right corner, click Plugins, and then click Install plugin.
Select the installation source and install the TONGYI and AliyunDMS plugins.
Install the TONGYI plugin from Marketplace.
Install the AliyunDMS plugin from DMS Plugins.
Wait for the plugins to be installed.
The installation is successful when the AliyunDMS and TONGYI plugins appear in the plugin list.
Step 2: Authorize the AliyunDMS plugin
Click the AliyunDMS plugin, and then click API Key Authorization Configuration.
Decide whether to configure the DMS API Key based on the plugin edition you need.
NoteBasic Edition: No API key needed.
Enterprise Edition: Requires DMS API key in
<AccessKeyID>:<AccessKeySecret>format. The AccessKey ID and AccessKey secret must be associated with your Alibaba Cloud account.
Click Save.
The authorization is successful when 1 Authorization appears on the component page.
Step 3: Configure an API key for the Qwen model
On the Studio page, click your account name and choose Settings.
On the Model Provider page, click Set next to the TONGYI (Qwen) model to configure its API Key.
You can obtain an API key from Alibaba Cloud Model Studio.
Click Save.
Step 4: Apply the ChatBI template
On the page, click Create From App Template.
In the template navigation pane on the left, click DMS Data+AI.
This category contains a series of templates provided by DMS.
Move the pointer over the Create app from ChatBI Plug-and-Play (Integrated Edition V6) card, and then click Use this template.
In the dialog box that appears, click Create.
The creation is successful when the ChatBI Plug-and-Play block appears on the page.
Step 5: Run the demo and try the ChatBI Agent
Click the ChatBI Plug-and-Play template.
The ChatBI template includes a built-in demo dataset.
In the upper-right corner, click Preview to try the ChatBI Agent.
Ask the Agent questions to query data.
Step 6: Configure your own ChatBI Agent
Click
, edit the db_connection_urlvariable, and change its value to the internal or public endpoint of the target database.Notedb_connection_urlis a global environment variable used in the workflow. When set todemo_db, the built-in dataset of the plugin is automatically loaded.The supported database types and endpoint formats are as follows:
MySQL:
mysql+pymysql://<user>:<password>@<host>:<port>/<database>.PostgreSQL:
postgresql+psycopg2://<user>:<password>@<host>:<port>/<database>.SQL Server:
mssql+pymssql://<user>:<password>@<host>:<port>/<database>.Oracle:
oracle+oracledb://<user>:<password>@<host>:<port>/<service_name>.Clickhouse:
clickhouse+native://<user>:<password>@<host>:<port>/<database>.MongoDB:
mongodb://<user>:<password>@<host>:<port>/<database>".
Click Save.
Depending on the database connection method, add the egress IP address or internal IP address of Dify to the database whitelist.
If you connect to the database over the internet, add the public egress IP address of Dify to the database whitelist.
Run the Query DIFY Public Egress IP node to obtain the specific IP address.
If you connect to the database through a VPC, add the IPv4 CIDR block of the VPC where Dify resides to the database whitelist.
After you add the IP address, click Preview and ask the Agent questions about the data in your target database.
Features of the AliyunDMS enterprise and basic edition plugins
Plugin | Description | Enterprise Edition | Basic Edition |
DMS NL2SQL (Basic Edition) | Built-in NL2SQL algorithm (Agile Edition). The agile natural language to SQL algorithm provides real-time streaming output of SQL results. | √ | √ |
DMS NL2SQL (Enterprise Edition) | Built-in NL2SQL algorithm (Enterprise Edition) with the following features:
| √ | × |
DMS SQL Executor (Basic Edition) | Requires a database account and password to connect to the database and execute SQL. Supports connections to MySQL, PostgreSQL, SQL Server, Oracle, ClickHouse, and MongoDB databases. | √ | √ |
DMS SQL Executor (Enterprise Edition) |
| √ | × |
DMS Data Visualization | Converts SQL execution results into ECharts charts. Supports column charts, line charts, pie charts, and tables. | √ | √ |
Use the AliyunDMS enterprise edition plugins
To use the AliyunDMS enterprise edition plugins, select the ChatBI Plug-and-Play (Enterprise Edition V6) template in Step 4: Apply the ChatBI template to create the application.
Notes
Before you use the ChatBI enterprise edition template, make sure that the DMS API KEY used to authorize the AliyunDMS plugins belongs to the Alibaba Cloud account that you use to log on to DMS.
Enterprise plugin configuration
DMS NL2SQL
Before you configure this plugin, add the target database instance to DMS and enable security hosting for the instance.
| Parameter descriptions:
|
DMS SQL Executor
| Parameter descriptions:
|
> Studio
