bank
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
--show shared_preload_libraries;
|
--show shared_preload_libraries;
|
||||||
|
|
||||||
|
alter database iut SET session_preload_libraries = 'anon';
|
||||||
|
|
||||||
create schema if not exists ext;
|
create schema if not exists ext;
|
||||||
create extension if not exists pgcrypto schema ext;
|
create extension if not exists pgcrypto schema ext;
|
||||||
create extension if not exists tablefunc;
|
create extension if not exists tablefunc;
|
||||||
@@ -144,6 +146,9 @@ select 'MXN', date, MXN from eurofxref;*/
|
|||||||
insert into exchange_rate
|
insert into exchange_rate
|
||||||
select 'NOK', date, NOK from eurofxref;
|
select 'NOK', date, NOK from eurofxref;
|
||||||
|
|
||||||
|
insert into exchange_rate
|
||||||
|
select 'SEK', date, NOK from eurofxref;
|
||||||
|
|
||||||
create or replace function latest_exchange_rate (
|
create or replace function latest_exchange_rate (
|
||||||
p_code text,
|
p_code text,
|
||||||
p_date date
|
p_date date
|
||||||
|
|||||||
21
02_tools.sql
21
02_tools.sql
@@ -23,3 +23,24 @@ grant select on all tables
|
|||||||
to metabase_user;
|
to metabase_user;
|
||||||
|
|
||||||
/* User grafana */
|
/* 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();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
"axisColorMode": "text",
|
"axisColorMode": "text",
|
||||||
"axisLabel": "",
|
"axisLabel": "",
|
||||||
"axisPlacement": "auto",
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
"barAlignment": 0,
|
"barAlignment": 0,
|
||||||
"barWidthFactor": 0.6,
|
"barWidthFactor": 0.6,
|
||||||
"drawStyle": "line",
|
"drawStyle": "line",
|
||||||
@@ -83,7 +84,7 @@
|
|||||||
},
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 8,
|
"h": 8,
|
||||||
"w": 12,
|
"w": 24,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0
|
"y": 0
|
||||||
},
|
},
|
||||||
@@ -111,7 +112,7 @@
|
|||||||
"editorMode": "code",
|
"editorMode": "code",
|
||||||
"format": "table",
|
"format": "table",
|
||||||
"rawQuery": true,
|
"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",
|
"refId": "A",
|
||||||
"sql": {
|
"sql": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@@ -133,6 +134,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"title": "Devises",
|
"title": "Devises",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "partitionByValues",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
"currency_code"
|
||||||
|
],
|
||||||
|
"keepFields": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"type": "timeseries"
|
"type": "timeseries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -140,15 +152,43 @@
|
|||||||
"schemaVersion": 41,
|
"schemaVersion": 41,
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"templating": {
|
"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": {
|
"time": {
|
||||||
"from": "1999-01-04T00:00:00.000Z",
|
"from": "2023-08-10T14:12:24.380Z",
|
||||||
"to": "2025-11-26T00:00:00.000Z"
|
"to": "2025-01-08T14:48:00.110Z"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"timepicker": {},
|
|
||||||
"timezone": "browser",
|
"timezone": "browser",
|
||||||
"title": "Currencies",
|
"title": "Currencies",
|
||||||
"uid": "967255c7-9164-487e-807f-154605a34e32",
|
"uid": "967255c7-9164-487e-807f-154605a34e32",
|
||||||
"version": 1
|
"version": 5
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user