You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PyDrill创建Apache Drill MySQL存储插件遇请求错误求助

Fixing the "Unrecognized field 'type'" Error When Creating MySQL Storage Plugin with PyDrill

Looks like the issue is with the structure of the configuration you're passing to drill.storage_update(). Let's break down what's going wrong and how to fix it:

Why You're Seeing This Error

The error message tells us that Drill's REST API expects a PluginConfigWrapper object, which only recognizes two properties: "config" and "name". But your current code is passing "type" as a top-level field instead of nesting it inside the "config" object. Additionally, your JSON has a syntax issue: enabled:true should be "enabled": true (keys need double quotes in valid JSON).

Corrected Code

Here's the fixed version of your code with proper structure and valid JSON:

drill = PyDrill(host='host', port='8047', user='xx')
# Nest all plugin settings inside the "config" field, fix JSON syntax
configu = {
    "config": {
        "type": "jdbc",
        "driver": "com.mysql.jdbc.Driver",
        "url": "jdbc:mysql://host:3306",
        "username": "xx",
        "password": "xx",
        "enabled": True
    }
}
# Pass the plugin name and the properly structured config
drill.storage_update('MySQL1', configu)

Key Changes Made:

  • Nested Configuration: All plugin-specific settings (type, driver, url, etc.) are now wrapped inside the "config" object, which matches what Drill's API expects.
  • Valid JSON Syntax: Fixed enabled:true to "enabled": True (ensured all keys are quoted and boolean values are formatted correctly). If you prefer using a string instead of a Python dictionary, make sure it's properly escaped:
    configu = '{"config": {"type": "jdbc","driver": "com.mysql.jdbc.Driver","url": "jdbc:mysql://host:3306","username": "xx","password": "xx","enabled": true}}'
    

This should resolve the 400 TransportError and successfully update your MySQL storage plugin.

内容的提问来源于stack exchange,提问作者Shrinivas Deshmukh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:22:42