标签: redash

AWS Redshift:列成行(宽到长)

我正在编写一个查询,其结果将在 redash 上显示为仪表板。查询基本上是特定时间范围内几列表的总和:

SELECT
   sum(col_A),
   sum(col_B),
   sum(col_C)
FROM
   table_X
WHERE
   timestamp > '2018-01-01'
   AND timestamp < '2018-02-01'
Run Code Online (Sandbox Code Playgroud)

结果是这样的:

col_A    col_B    col_C    
123      456      789
Run Code Online (Sandbox Code Playgroud)

但是,要在 redash 上正确呈现 dasboard,我需要长格式的结果:

column   sum
col_A    123
col_B    456
col_C    789
Run Code Online (Sandbox Code Playgroud)

如何将结果从宽格式转换为长格式?

sql amazon-redshift redash

4
推荐指数
1
解决办法
1797
查看次数

在普罗米修斯上构建 redash 图表

我正在尝试根据 prometheus 数据源的查询创建 Redash 图表: rate(active_devices_count[1w])。我期望看到基于日期/值的图表,就像我在 Grafana 中看到的那样,但我在图表上只看到单行。我看起来像 redash 只显示最后检索的值。 redash 第一个查询 grafana第一个查询

在查询中active_devices_count我只看到点,而在 grafana 中我也可以看到图形 redash 第二个查询 grafana第二个查询

prometheus redash

3
推荐指数
1
解决办法
737
查看次数

通过ObjectID对Redash MongoDB进行查询

我有一个具有以下文档结构的集合:

{
    "_id" : ObjectId("58aa706c658d1dc6c700002c"),
    "source" : "web",
    "type" : "Comentarios",
    "email" : "jhondoe@xyz.com",
    "updated_at" : ISODate("2017-02-20T04:28:28.623Z"),
    "created_at" : ISODate("2017-02-20T04:28:28.623Z")
}
Run Code Online (Sandbox Code Playgroud)

我需要在Redash语法中构建一个查询以通过'_id'获取文档.我构建了以下查询,但总是出现错误:"查询格式无效.查询不是有效的JSON."

{
    "collection": "commerce_messages",
    "query" : {
        "_id": "ObjectId(58aa706c658d1dc6c700002c)"
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试将ObjectId括在引号上,但查询不返回结果.

我发现的唯一文档是在这个链接:https://redash.io/help/queries/querying_mongodb.html但他们没有解释如何查询ObjectId.

mongodb objectid redash

1
推荐指数
1
解决办法
1418
查看次数

无法从Redash连接到本地主机

我正在尝试从Redash连接到本地Postgres。(都来自redash.io和http://0.0.0.0:5000/),但无法连接到它。我可以连接本地主机的其他工具,但是从Redash中我得到了错误:

 Connection Test Failed:
 could not connect to server: Connection refused Is the server running 
 on host "localhost" (::1) and accepting TCP/IP connections on port 
 5432? could not connect to server: Connection refused Is the server 
 running on host "localhost" (127.0.0.1) and accepting TCP/IP 
 connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

任何想法可能是什么问题?我将docker用于我的本地Redash,这可能会导致问题,但是我也从redash.io中得到了相同的错误。

这是我的docker-compose文件:

# This configuration file is for **development** setup. For production, refer to
# docker-compose.production.yml.
version: '2'
services:
  server:
    build: .
    command: dev_server
    depends_on:
      - postgres
      - redis
    ports: …
Run Code Online (Sandbox Code Playgroud)

postgresql redash

1
推荐指数
1
解决办法
1114
查看次数