clickhouse-grafana icon indicating copy to clipboard operation
clickhouse-grafana copied to clipboard

error querying the database: code: 1000, message: Bad URI syntax: URI contains invalid characters

Open hlf2016 opened this issue 2 years ago • 1 comments

issues

There is some problem while I use the plugin with page variables. If there is a variable, the query will return "error querying the database: code: 1000, message: Bad URI syntax: URI contains invalid characters" and the data can't be rendered properly. But if no variable , everything goes well.

Just see the two images bellow:

  • variable exists image image

  • no variable image

Data

I tried to figure out the reason. There is some data I can provide.

sql

  • variable exists
WITH 
src as ( 
  SELECT extract(s, 'NOUN:([a-z]+)') lem , i , sumi , i/sumi perc 
  FROM kpsi.clec , 
  ( SELECT sum(i) sumi FROM kpsi.clec WHERE s like 'open:VERB:dobj:NOUN:%') t 
  WHERE s like 'open:VERB:dobj:NOUN:%' 
) , 
tgt as ( 
  SELECT * , cnt/sumi perc 
  FROM url(
     'http://cpu76.wrask.com:8000/es/rows?query= SELECT %20count%28%2A%29%20cnt%20from%20dic%20where%20type%20%3D%20%27tok%27%20and%20gov%20%3D%27open_VERB%27%20and%20dep%20%3D%20%27dobj%27%20and%20pos%3D%27NOUN%27' , 
     JSONEachRow , 
     'lem String , cnt UInt32 , sumi UInt32') 
) 
SELECT tgt.lem , src.i cnt1 , tgt.cnt cnt2 , src.perc perc1 , tgt.perc perc2 , keyness(src.i, tgt.cnt, src.sumi, tgt.sumi) kn 
FROM src right outer 
JOIN tgt ON src.lem = tgt.lem 
ORDER BY kn
  • no variable
with src as ( 
  select extract(s, 'NOUN:([a-z]+)') lem, i, sumi, i/sumi perc 
  from kpsi.clec, 
   (select sum(i) sumi from kpsi.clec where s like 'open:VERB:dobj:NOUN:%') t 
  where s like 'open:VERB:dobj:NOUN:%' ), 
tgt as ( 
  select *, cnt/sumi perc 
  from url('http://cpu76.wrask.com:8000/es/rows?query=select lem, count(*) cnt from dic where type = 'tok' and gov ='open_VERB' and dep = 'dobj' and pos='NOUN' group by lem order by cnt desc
    &raw=false
    &sum_query=select count(*) cnt from dic where type = 'tok' and gov ='open_VERB' and dep = 'dobj' and pos='NOUN'', 
    JSONEachRow, 
   'lem String, cnt UInt32, sumi UInt32'
  )  
) 
select tgt.lem, src.i cnt1, tgt.cnt cnt2, src.perc perc1, tgt.perc perc2 , keyness(src.i, tgt.cnt, src.sumi, tgt.sumi) kn 
from src right outer join tgt on src.lem = tgt.lem
order by kn

version

  • grafana v9.0.0 (b5c56f6371)
  • clickhouse 1.1.2

hlf2016 avatar Aug 03 '22 08:08 hlf2016

@hlf2016 sorry for late response

could you clarify what mean "clickhouse 1.1.2" ? this is clickhouge-grafana plugin version? or clickhouse-server version?

could you share screenshot from /plugins endpoint for your grafana installation? which plugin do you exactly installed? https://github.com/grafana/clickhouse-datasource or https://github.com/Altinity/clickhouse-grafana ?

and could you share your original query where $asd variable macro present?

Slach avatar Sep 05 '22 03:09 Slach

@hlf2016 sorry i need to close issue cause provided information is not enough for reproduce

Slach avatar Mar 28 '24 10:03 Slach