From 53f488e40c065bce488407ac41e388e33caead5a Mon Sep 17 00:00:00 2001 From: Jakob Dalsgaard Date: Mon, 12 May 2025 12:43:34 +0200 Subject: [PATCH] Fixing database script and adding information... --- db/createdb.sql | 2 +- readme.md | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/db/createdb.sql b/db/createdb.sql index 5229ad8..315647d 100644 --- a/db/createdb.sql +++ b/db/createdb.sql @@ -25,7 +25,7 @@ create table training ( constraint fk_account foreign key (account) references account(id) ); create view dailylift as select - date_trunc('day', time) as time, account, exercise, sum(runs * reps * kilos) as lift + date(time) as time, account, exercise, sum(runs * reps * kilos) as lift from training group by 1, 2, 3; diff --git a/readme.md b/readme.md index 89d1aee..6b6a315 100644 --- a/readme.md +++ b/readme.md @@ -62,4 +62,18 @@ When travelling you might opt for specifying a specific location on the command TZ=Australia/Sydney train squat 3 10 60 ``` -Data in the database can be visualized with, for example, Grafana, more info to follow. +Grafana Visaulisation +===================== + +In `grafana/training-dashboard.json` a small dashboard is presented, a Postgres data source +must be defined, and the data base user must have access to select from tables in the training database. + +``` +grant select on account to grafana_query; +grant select on training to grafan_query; +grant select on exercise to grafan_query; +grant select on dailylist to grafan_query; +``` + + +