I’m using a grafana docker image grafana/grafana-enterprise:8.2.0
.
I’m capable of adding a Postgres DB as a datasource. See picture below.
The db is another docker image for postgres:15.3-alpine.
There’s only 1 table, with 10 entries, all obeying the following schema:
id = Column(Integer, primary_key=True, index=True, nullable=False)
title = Column(String)
content = Column(String)
published = Column(Boolean, server_default="TRUE")
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text("now()"))
So, created_at
is a field of type time, I think…
When I try to create a dashboard in grafana, with data source as the postgres db, with the query:
When I check the logs, I see:
t=2023-05-24T15:44:58+0000 lvl=dbug msg="Querying for data source via SQL store" logger=datasources id=1 orgId=1
t=2023-05-24T15:44:58+0000 lvl=dbug msg="Processing metrics query" logger=http.server query="&{data:map[datasourceId:1 format:time_series intervalMs:60000 maxDataPoints:1070 rawSql:SELECT *\nFROM posts;\n refId:A]}"
t=2023-05-24T15:44:58+0000 lvl=eror msg="query error" logger=tsdb.postgres err="dial tcp :5432: connect: connection refused"
t=2023-05-24T15:44:58+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=newuser method=POST path=/api/ds/query status=400 remote_addr=172.18.0.1 time_ms=1 size=248 referer="http://grafana.staged-by-discourse.com/explore?left=%5B%22now-6h%22,%22now%22,%22PostgreSQL%22,%7B%22refId%22:%22A%22,%22hide%22:true,%22format%22:%22time_series%22,%22timeColumn%22:%22time%22,%22metricColumn%22:%22none%22,%22group%22:%5B%5D,%22where%22:%5B%7B%22type%22:%22macro%22,%22name%22:%22$__timeFilter%22,%22params%22:%5B%5D%7D%5D,%22select%22:%5B%5B%7B%22type%22:%22column%22,%22params%22:%5B%22value%22%5D%7D%5D%5D,%22rawQuery%22:true,%22rawSql%22:%22SELECT%5Cn%20*%5CnFROM%5Cn%20%20posts;%5Cn%22,%22datasource%22:%22PostgreSQL%22%7D%5D&orgId=1"
There’s something amiss here…