python-3.6apache-drillpydrill

Use pydrill storage_update() to create Apache drill storage


I am trying to create MySQL apache drill storage plugin using pydrill. It is throwing error:

RequestError: TransportError(400, 'Unrecognized field "type" (class org.apache.drill.exec.server.rest.PluginConfigWrapper), not marked as ignorable (2 known properties: "config", "name"])\n at [Source: org.glassfish.jersey.message.internal.EntityInputStream@1843f42f; line: 1, column: 138] (through reference chain: org.apache.drill.exec.server.rest.PluginConfigWrapper["type"])') Here is my code:

drill = PyDrill(host='host',port='8047',user='xx')

configu = '{"type": "jdbc","driver": "com.mysql.jdbc.Driver","url": "jdbc:mysql://host:3306","username": "xx","password": "xx",enabled:true}'
drill.storage_update('MySQL1',configu)

Any help is highly appreciated!


Solution

  • I found out the solution. We need to pass the storage name as a parameter, and as a json 'key':'value' in the config parameter. Here is the corrected code:

    configu={'config': {'driver': 'com.mysql.jdbc.Driver','enabled': True,'password': 'xyz','type': 'jdbc','url': 'jdbc:mysql://host:3306','username': 'xx'},'name':'xxx'}
    
    drill.storage_update('xxx',config=configu)
    

    And Bingo! It worked!