druid basic security

I have assigned permission to role like below and assigned role to user. It is working in case of JSON QUERY, but it is not working in case of DRUID SQL

query over http and JDBC way. It is throwing error like ‘dddc’ object not found. Please suggest. I have been 0.12.1 DRUID version.

{

“name”: “xyz”,

“permissions”: [

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “DATASOURCE”

},

“action”: “READ”

},

“resourceNamePattern”: “.*”

},

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “DATASOURCE”

},

“action”: “WRITE”

},

“resourceNamePattern”: “.*”

},

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “CONFIG”

},

“action”: “READ”

},

“resourceNamePattern”: “.*”

},

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “CONFIG”

},

“action”: “WRITE”

},

“resourceNamePattern”: “.*”

},

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “STATE”

},

“action”: “READ”

},

“resourceNamePattern”: “.*”

},

{

“resourceAction”: {

“resource”: {

“name”: “.*”,

“type”: “STATE”

},

“action”: “WRITE”

},

“resourceNamePattern”: “.*”

}

]

}

facing same issue.

Can you provide full details on the query you’re running and the exact commands you’re using to run the SQL queries?

command :

curl -u user:password -H ‘Content-Type: application/json’ http://host:8082/druid/v2/sql -d @query1.json

query :- not working

{“query”:“SELECT COUNT(*) AS TheCount FROM test limit 1”}

error :

{

“error”:“Unknown exception”,“errorMessage”:“org.apache.calcite.runtime.CalciteContextException: From line 1, column 34 to line 1, column 37: Object ‘test’ not found”,“errorClass”:“org.apache.calcite.tools.ValidationException”,“host”:null

}

json query: working

{

“queryType” : “topN”,

“dataSource” : “test”,

“intervals” : [“2015-09-12/2020-09-13”],

“granularity” : “all”,

“dimension” : “name”,

“metric” : “count”,

“threshold” : 10,

“aggregations” : [

{

“type” : “count”,

“name” : “count”

}

]

}

In case of avatica when it is asking for username and password then i am entering

Enter username for jdbc:avatica:remote:url=host:8082/druid/v2/sql/avatica/:

Enter password for jdbc:avatica:remote:url=host8082/druid/v2/sql/avatica/:

but when i run following command on sqlline.bat

!tables

Hm, a few things you could check:

  • Does SQL work if you use the admin user that was created automatically by the extension?
  • Do you see any error logs while the Broker is running?
  • What’s the output if you run the SQL query:
    SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘druid’
  • What’s the output if you issue a GET to /druid/coordinator/v1/datasources on the coordinator as your custom user, vs. as admin?

Thanks for your greate help. Solved.