This commit is contained in:
2025-11-30 20:44:57 +01:00
parent a494370ded
commit aef1c99d0c
3 changed files with 73 additions and 7 deletions

View File

@@ -8,6 +8,8 @@
--show shared_preload_libraries;
alter database iut SET session_preload_libraries = 'anon';
create schema if not exists ext;
create extension if not exists pgcrypto schema ext;
create extension if not exists tablefunc;
@@ -144,6 +146,9 @@ select 'MXN', date, MXN from eurofxref;*/
insert into exchange_rate
select 'NOK', date, NOK from eurofxref;
insert into exchange_rate
select 'SEK', date, NOK from eurofxref;
create or replace function latest_exchange_rate (
p_code text,
p_date date

View File

@@ -23,3 +23,24 @@ grant select on all tables
to metabase_user;
/* User grafana */
create role grafana_user with
login
nosuperuser
nocreatedb
nocreaterole
noinherit
noreplication
connection limit -1
password 'supermotdepasse';
grant usage
on schema public
to grafana_user;
grant select on all tables
in schema public
to grafana_user;
create extension anon;
select anon.init();

View File

@@ -37,6 +37,7 @@
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
@@ -83,7 +84,7 @@
},
"gridPos": {
"h": 8,
"w": 12,
"w": 24,
"x": 0,
"y": 0
},
@@ -111,7 +112,7 @@
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "select date, rate, currency_code from exchange_rate ",
"rawSql": "select date, rate, currency_code from exchange_rate where currency_code in (${devises:sqlstring}) and $__timeFilter(date) ",
"refId": "A",
"sql": {
"columns": [
@@ -133,6 +134,17 @@
}
],
"title": "Devises",
"transformations": [
{
"id": "partitionByValues",
"options": {
"fields": [
"currency_code"
],
"keepFields": false
}
}
],
"type": "timeseries"
}
],
@@ -140,15 +152,43 @@
"schemaVersion": 41,
"tags": [],
"templating": {
"list": []
"list": [
{
"allowCustomValue": false,
"current": {
"text": [
"SEK",
"NOK"
],
"value": [
"SEK",
"NOK"
]
},
"definition": "select code from currency",
"label": "Devises",
"multi": true,
"name": "devises",
"options": [],
"query": "select code from currency",
"refresh": 1,
"regex": "",
"type": "query"
}
]
},
"time": {
"from": "1999-01-04T00:00:00.000Z",
"to": "2025-11-26T00:00:00.000Z"
"from": "2023-08-10T14:12:24.380Z",
"to": "2025-01-08T14:48:00.110Z"
},
"timepicker": {
"refresh_intervals": [
"2h",
"1d"
]
},
"timepicker": {},
"timezone": "browser",
"title": "Currencies",
"uid": "967255c7-9164-487e-807f-154605a34e32",
"version": 1
"version": 5
}