Skip to content

SQL 查询插件调用触发 KeyError: 'db_properties' #53

@cydcydcyd

Description

@cydcydcyd

Please confirm before submission 在提交之前,请确认

Dify version Dify版本

Version 1.10.1

db_query or db_query_pre_auth

Database Query (Pre-authorization) 数据库查询(预授权)

Plugin version 插件版本

0.0.10

database and version 数据库及版本

mysql 8.0

Problem description 问题描述

Issue Title

[Bug] SQL 查询插件调用触发 KeyError: 'db_properties'

Description

问题概述

调用 SQL 查询插件 sql_query_pre_auth 执行指定 SQL 语句时,工具返回 PluginInvokeError,核心错误为 KeyError: 'db_properties',导致 SQL 查询请求失败,无法获取目标数据。

复现步骤

  1. 构造如下工具调用请求(仅包含 query_sqloutput_format 参数):
    {
      "sql_query_pre_auth": {
        "query_sql": "SELECT data_year, val FROM t_cw WHERE company_name = 'xx集团' AND index_name = '累计营业总收入' AND ((data_year BETWEEN 2021 AND 2024 AND data_month = 12) OR (data_year = 2025 AND data_month = 8));",
        "output_format": "markdown"
      }
    }
    
  2. 发送请求至插件接口;
  3. 插件返回调用错误,错误信息如下:
    json
    {
    "sql_query_pre_auth": "tool invoke error: req_id: f3bb3cb7b4 PluginInvokeError: {"args":{},"error_type":"KeyError","message":"'db_properties'"}"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions