Git Product home page Git Product logo

Comments (3)

hagen1778 avatar hagen1778 commented on June 11, 2024

Hi @podshumok
Sorry for late response. I have just tried to use some func in unescape macros and it works well:

SELECT
    $unescape(intDiv($col, $col2)) d,
    count()
FROM $table
WHERE $timeFilter and $unescape($col) = 1
GROUP BY d

Converted to:

SELECT intDiv(Aid, Ms) d, count() 
FROM default.events 
WHERE EventDate BETWEEN toDate(1519404902) 
AND toDate(1519405682) 
AND EventTime BETWEEN toDateTime(1519404902) 
AND toDateTime(1519405682) 
AND Aid = 1 
GROUP BY d

Can u provide me with full example of query?

from clickhouse-grafana.

hagen1778 avatar hagen1778 commented on June 11, 2024

Closed due to inactivity

from clickhouse-grafana.

code-of-kpp avatar code-of-kpp commented on June 11, 2024

Hello!

So I finally figured out an example that is simple enough to demonstrate

Here is a minimal dashboard with problem I am dealing with:

{
  "panels": [
    {
      "datasource": "clickhouse",
      "id": 2,
      "targets": [
        {
          "format": "table",
          "query": "SELECT\n  $unescape($f) AS b\nFROM (\n  SELECT * FROM system.numbers LIMIT 1\n)"
        }
      ],
      "type": "singlestat"
    }
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "count",
          "value": "count()"
        },
        "multi": true,
        "name": "f",
        "options": [
          {
            "selected": true,
            "text": "count",
            "value": "count()"
          },
          {
            "selected": false,
            "text": "sum",
            "value": "sum(number)"
          },
          {
            "selected": false,
            "text": "other",
            "value": "concat('a', toString(number))"
          }
        ],
        "type": "custom"
      }
    ]
  },
  "title": "New dashboard"
}

Looks like a problem
In this case macros will add additional ) after function call and it also will replace '' symbols in the variable (see other option)

from clickhouse-grafana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.