dao-treasury 0.0.29__cp311-cp311-win32.whl → 0.0.31__cp311-cp311-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 17ebe61b88bd37338d0a__mypyc.cp311-win32.pyd +0 -0
- dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +8 -0
- dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +116 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +22 -22
- dao_treasury/_docker.cp311-win32.pyd +0 -0
- dao_treasury/_docker.py +23 -18
- dao_treasury/_nicknames.cp311-win32.pyd +0 -0
- dao_treasury/_wallet.cp311-win32.pyd +0 -0
- dao_treasury/constants.cp311-win32.pyd +0 -0
- dao_treasury/db.py +172 -16
- dao_treasury/docker-compose.yaml +1 -0
- dao_treasury/main.py +27 -3
- dao_treasury/sorting/__init__.cp311-win32.pyd +0 -0
- dao_treasury/sorting/__init__.py +1 -0
- dao_treasury/sorting/_matchers.cp311-win32.pyd +0 -0
- dao_treasury/sorting/_rules.cp311-win32.pyd +0 -0
- dao_treasury/sorting/factory.cp311-win32.pyd +0 -0
- dao_treasury/sorting/rule.cp311-win32.pyd +0 -0
- dao_treasury/sorting/rule.py +5 -0
- dao_treasury/sorting/rules/__init__.cp311-win32.pyd +0 -0
- dao_treasury/sorting/rules/__init__.py +1 -0
- dao_treasury/sorting/rules/ignore/__init__.cp311-win32.pyd +0 -0
- dao_treasury/sorting/rules/ignore/__init__.py +1 -0
- dao_treasury/sorting/rules/ignore/llamapay.cp311-win32.pyd +0 -0
- dao_treasury/sorting/rules/ignore/llamapay.py +20 -0
- dao_treasury/streams/__init__.cp311-win32.pyd +0 -0
- dao_treasury/streams/__init__.py +0 -0
- dao_treasury/streams/llamapay.cp311-win32.pyd +0 -0
- dao_treasury/streams/llamapay.py +363 -0
- dao_treasury/treasury.py +25 -4
- dao_treasury/types.cp311-win32.pyd +0 -0
- {dao_treasury-0.0.29.dist-info → dao_treasury-0.0.31.dist-info}/METADATA +37 -5
- dao_treasury-0.0.31.dist-info/RECORD +49 -0
- dao_treasury-0.0.31.dist-info/top_level.txt +2 -0
- 8d7637a0eb7617042369__mypyc.cp311-win32.pyd +0 -0
- dao_treasury-0.0.29.dist-info/RECORD +0 -37
- dao_treasury-0.0.29.dist-info/top_level.txt +0 -2
- {dao_treasury-0.0.29.dist-info → dao_treasury-0.0.31.dist-info}/WHEEL +0 -0
Binary file
|
@@ -24,3 +24,11 @@ providers:
|
|
24
24
|
editable: false
|
25
25
|
options:
|
26
26
|
path: /etc/grafana/provisioning/dashboards/transactions
|
27
|
+
|
28
|
+
- name: 'LlamaPay Streams'
|
29
|
+
folder: 'streams'
|
30
|
+
type: file
|
31
|
+
disableDeletion: true
|
32
|
+
editable: false
|
33
|
+
options:
|
34
|
+
path: /etc/grafana/provisioning/dashboards/streams
|
@@ -0,0 +1,116 @@
|
|
1
|
+
{
|
2
|
+
"annotations": {
|
3
|
+
"list": [
|
4
|
+
{
|
5
|
+
"builtIn": 1,
|
6
|
+
"datasource": {
|
7
|
+
"type": "grafana",
|
8
|
+
"uid": "-- Grafana --"
|
9
|
+
},
|
10
|
+
"enable": true,
|
11
|
+
"hide": true,
|
12
|
+
"iconColor": "rgba(0, 211, 255, 1)",
|
13
|
+
"name": "Annotations & Alerts",
|
14
|
+
"type": "dashboard"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
},
|
18
|
+
"editable": true,
|
19
|
+
"fiscalYearStartMonth": 0,
|
20
|
+
"graphTooltip": 0,
|
21
|
+
"id": 7,
|
22
|
+
"links": [],
|
23
|
+
"liveNow": false,
|
24
|
+
"panels": [
|
25
|
+
{
|
26
|
+
"datasource": {
|
27
|
+
"type": "frser-sqlite-datasource",
|
28
|
+
"uid": "P2D2EEF3E092AF52B"
|
29
|
+
},
|
30
|
+
"description": "",
|
31
|
+
"fieldConfig": {
|
32
|
+
"defaults": {
|
33
|
+
"color": {
|
34
|
+
"mode": "thresholds"
|
35
|
+
},
|
36
|
+
"custom": {
|
37
|
+
"align": "auto",
|
38
|
+
"cellOptions": {
|
39
|
+
"type": "auto"
|
40
|
+
},
|
41
|
+
"inspect": false
|
42
|
+
},
|
43
|
+
"mappings": [],
|
44
|
+
"thresholds": {
|
45
|
+
"mode": "absolute",
|
46
|
+
"steps": [
|
47
|
+
{
|
48
|
+
"color": "green",
|
49
|
+
"value": null
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"color": "red",
|
53
|
+
"value": 80
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"overrides": []
|
59
|
+
},
|
60
|
+
"gridPos": {
|
61
|
+
"h": 19,
|
62
|
+
"w": 24,
|
63
|
+
"x": 0,
|
64
|
+
"y": 0
|
65
|
+
},
|
66
|
+
"id": 1,
|
67
|
+
"options": {
|
68
|
+
"cellHeight": "sm",
|
69
|
+
"footer": {
|
70
|
+
"countRows": false,
|
71
|
+
"fields": "",
|
72
|
+
"reducer": [
|
73
|
+
"sum"
|
74
|
+
],
|
75
|
+
"show": false
|
76
|
+
},
|
77
|
+
"showHeader": true
|
78
|
+
},
|
79
|
+
"pluginVersion": "10.2.0",
|
80
|
+
"targets": [
|
81
|
+
{
|
82
|
+
"datasource": {
|
83
|
+
"type": "frser-sqlite-datasource",
|
84
|
+
"uid": "P2D2EEF3E092AF52B"
|
85
|
+
},
|
86
|
+
"queryText": "select stream_id as \"Stream ID\", b.address as \"Factory\", start_block as \"Start Block\", end_block as \"End Block\", c.symbol as \"Token\", d.address as \"From\", e.address as \"To\", reason as \"Reason\", amount_per_second as \"Amount Per Second\", status as \"Status\", txgroup as \"TxGroup\"\nfrom streams a\nleft join addresses b on a.contract = b.address_id\nleft join tokens c on a.token = c.token_id\nleft join addresses d on a.from_address = d.address_id\nleft join addresses e on a.to_address = e.address_id",
|
87
|
+
"queryType": "table",
|
88
|
+
"rawQueryText": "select stream_id as \"Stream ID\", b.address as \"Factory\", start_block as \"Start Block\", end_block as \"End Block\", c.symbol as \"Token\", d.address as \"From\", e.address as \"To\", reason as \"Reason\", amount_per_second as \"Amount Per Second\", status as \"Status\", txgroup as \"TxGroup\"\nfrom streams a\nleft join addresses b on a.contract = b.address_id\nleft join tokens c on a.token = c.token_id\nleft join addresses d on a.from_address = d.address_id\nleft join addresses e on a.to_address = e.address_id",
|
89
|
+
"refId": "A",
|
90
|
+
"timeColumns": [
|
91
|
+
"time",
|
92
|
+
"ts"
|
93
|
+
]
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"title": "LlamaPay Streams",
|
97
|
+
"type": "table"
|
98
|
+
}
|
99
|
+
],
|
100
|
+
"refresh": "",
|
101
|
+
"schemaVersion": 38,
|
102
|
+
"tags": [],
|
103
|
+
"templating": {
|
104
|
+
"list": []
|
105
|
+
},
|
106
|
+
"time": {
|
107
|
+
"from": "now-6h",
|
108
|
+
"to": "now"
|
109
|
+
},
|
110
|
+
"timepicker": {},
|
111
|
+
"timezone": "",
|
112
|
+
"title": "LlamaPay",
|
113
|
+
"uid": "aa4d62a2-9e52-4acc-8f38-a96c77810aca",
|
114
|
+
"version": 1,
|
115
|
+
"weekStart": ""
|
116
|
+
}
|
@@ -71,9 +71,9 @@
|
|
71
71
|
"targets": [
|
72
72
|
{
|
73
73
|
"datasource": "SQLite",
|
74
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
74
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Revenue'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
75
75
|
"queryType": "table",
|
76
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
76
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Revenue'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
77
77
|
"refId": "A",
|
78
78
|
"timeColumns": [
|
79
79
|
"time",
|
@@ -133,9 +133,9 @@
|
|
133
133
|
"targets": [
|
134
134
|
{
|
135
135
|
"datasource": "SQLite",
|
136
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
136
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Expenses'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
137
137
|
"queryType": "table",
|
138
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
138
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Expenses'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
139
139
|
"refId": "A",
|
140
140
|
"timeColumns": [
|
141
141
|
"time",
|
@@ -195,9 +195,9 @@
|
|
195
195
|
"targets": [
|
196
196
|
{
|
197
197
|
"datasource": "SQLite",
|
198
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
198
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Cost of Revenue'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
199
199
|
"queryType": "table",
|
200
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
200
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Cost of Revenue'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
201
201
|
"refId": "A",
|
202
202
|
"timeColumns": [
|
203
203
|
"time",
|
@@ -257,9 +257,9 @@
|
|
257
257
|
"targets": [
|
258
258
|
{
|
259
259
|
"datasource": "SQLite",
|
260
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
260
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Other Income'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
261
261
|
"queryType": "table",
|
262
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
262
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Other Income'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
263
263
|
"refId": "A",
|
264
264
|
"timeColumns": [
|
265
265
|
"time",
|
@@ -319,9 +319,9 @@
|
|
319
319
|
"targets": [
|
320
320
|
{
|
321
321
|
"datasource": "SQLite",
|
322
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
322
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Other Expenses'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
323
323
|
"queryType": "table",
|
324
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
324
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Other Expenses'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
325
325
|
"refId": "A",
|
326
326
|
"timeColumns": [
|
327
327
|
"time",
|
@@ -382,9 +382,9 @@
|
|
382
382
|
"targets": [
|
383
383
|
{
|
384
384
|
"datasource": "SQLite",
|
385
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM
|
385
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000",
|
386
386
|
"queryType": "table",
|
387
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM
|
387
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000",
|
388
388
|
"refId": "A",
|
389
389
|
"timeColumns": [
|
390
390
|
"time",
|
@@ -498,9 +498,9 @@
|
|
498
498
|
"targets": [
|
499
499
|
{
|
500
500
|
"datasource": "SQLite",
|
501
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) AS \"Total Revenue\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) AS \"Net\"\nFROM
|
501
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) AS \"Total Revenue\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) AS \"Net\"\nFROM general_ledger AS t\nJOIN group_hierarchy gh\n ON t.txgroup_id = gh.txgroup_id\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\nGROUP BY timestamp\nORDER BY timestamp;",
|
502
502
|
"queryType": "table",
|
503
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) AS \"Total Revenue\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) AS \"Net\"\nFROM
|
503
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) AS \"Total Revenue\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses') THEN t.value_usd ELSE 0 END) AS \"Net\"\nFROM general_ledger AS t\nJOIN group_hierarchy gh\n ON t.txgroup_id = gh.txgroup_id\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\nGROUP BY timestamp\nORDER BY timestamp;",
|
504
504
|
"refId": "A",
|
505
505
|
"timeColumns": [
|
506
506
|
"timestamp"
|
@@ -643,9 +643,9 @@
|
|
643
643
|
"targets": [
|
644
644
|
{
|
645
645
|
"datasource": "SQLite",
|
646
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
646
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Sort Me (Inbound)'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
647
647
|
"queryType": "table",
|
648
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
648
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Sort Me (Inbound)'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
649
649
|
"refId": "A",
|
650
650
|
"timeColumns": [
|
651
651
|
"time",
|
@@ -706,9 +706,9 @@
|
|
706
706
|
"targets": [
|
707
707
|
{
|
708
708
|
"datasource": "SQLite",
|
709
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
709
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Sort Me (Outbound)'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
710
710
|
"queryType": "table",
|
711
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM
|
711
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT txgroup_id, name AS top_category, parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n SUM(t.value_usd) AS total_revenue\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE gh.top_category = 'Sort Me (Outbound)'\n AND t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\n",
|
712
712
|
"refId": "A",
|
713
713
|
"timeColumns": [
|
714
714
|
"time",
|
@@ -769,9 +769,9 @@
|
|
769
769
|
"targets": [
|
770
770
|
{
|
771
771
|
"datasource": "SQLite",
|
772
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Inbound)\n + SUM(CASE WHEN gh.top_category = 'Sort Me (Inbound)' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Outbound)\n - SUM(CASE WHEN gh.top_category = 'Sort Me (Outbound)' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM
|
772
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Inbound)\n + SUM(CASE WHEN gh.top_category = 'Sort Me (Inbound)' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Outbound)\n - SUM(CASE WHEN gh.top_category = 'Sort Me (Outbound)' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000",
|
773
773
|
"queryType": "table",
|
774
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Inbound)\n + SUM(CASE WHEN gh.top_category = 'Sort Me (Inbound)' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Outbound)\n - SUM(CASE WHEN gh.top_category = 'Sort Me (Outbound)' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM
|
774
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n (\n -- Revenue\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n -- Cost of Revenue\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n -- Expenses\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n -- Other Income\n + SUM(CASE WHEN gh.top_category = 'Other Income' THEN t.value_usd ELSE 0 END)\n -- Other Expenses\n - SUM(CASE WHEN gh.top_category = 'Other Expenses' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Inbound)\n + SUM(CASE WHEN gh.top_category = 'Sort Me (Inbound)' THEN t.value_usd ELSE 0 END)\n -- Sort Me (Outbound)\n - SUM(CASE WHEN gh.top_category = 'Sort Me (Outbound)' THEN t.value_usd ELSE 0 END)\n ) AS total_net\nFROM general_ledger t\nJOIN group_hierarchy gh USING (txgroup_id)\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000",
|
775
775
|
"refId": "A",
|
776
776
|
"timeColumns": [
|
777
777
|
"time",
|
@@ -885,9 +885,9 @@
|
|
885
885
|
"targets": [
|
886
886
|
{
|
887
887
|
"datasource": "SQLite",
|
888
|
-
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) AS \"Total Revenue (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) AS \"Net (incl. Unsorted)\"\nFROM
|
888
|
+
"queryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) AS \"Total Revenue (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) AS \"Net (incl. Unsorted)\"\nFROM general_ledger AS t\nJOIN group_hierarchy gh\n ON t.txgroup_id = gh.txgroup_id\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\nGROUP BY timestamp\nORDER BY timestamp;",
|
889
889
|
"queryType": "table",
|
890
|
-
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) AS \"Total Revenue (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) AS \"Net (incl. Unsorted)\"\nFROM
|
890
|
+
"rawQueryText": "WITH RECURSIVE group_hierarchy (txgroup_id, top_category, parent_txgroup) AS (\n SELECT\n txgroup_id,\n name AS top_category,\n parent_txgroup\n FROM txgroups\n WHERE parent_txgroup IS NULL\n\n UNION ALL\n\n SELECT\n child.txgroup_id,\n parent.top_category,\n child.parent_txgroup\n FROM txgroups AS child\n JOIN group_hierarchy AS parent\n ON child.parent_txgroup = parent.txgroup_id\n)\nSELECT\n t.timestamp,\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) AS \"Total Revenue (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses (incl. Unsorted)\",\n SUM(CASE WHEN gh.top_category in ('Revenue', 'Other Income','Sort Me (Inbound)') THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses','Other Expenses','Sort Me (Outbound)') THEN t.value_usd ELSE 0 END) AS \"Net (incl. Unsorted)\"\nFROM general_ledger AS t\nJOIN group_hierarchy gh\n ON t.txgroup_id = gh.txgroup_id\nWHERE t.timestamp >= $__from/1000\n AND t.timestamp <= $__to/1000\nGROUP BY timestamp\nORDER BY timestamp;",
|
891
891
|
"refId": "A",
|
892
892
|
"timeColumns": [
|
893
893
|
"timestamp"
|
Binary file
|
dao_treasury/_docker.py
CHANGED
@@ -1,33 +1,38 @@
|
|
1
1
|
"""This module contains utilities for managing dao-treasury's docker containers"""
|
2
2
|
|
3
3
|
import logging
|
4
|
-
import
|
4
|
+
from importlib import resources
|
5
5
|
import subprocess
|
6
6
|
from functools import wraps
|
7
|
-
from typing import Any, Callable, Coroutine, Final, Iterable, Tuple, TypeVar
|
7
|
+
from typing import Any, Callable, Coroutine, Final, Iterable, Tuple, TypeVar, List
|
8
8
|
|
9
9
|
import eth_portfolio_scripts.docker
|
10
10
|
from typing_extensions import ParamSpec
|
11
11
|
|
12
12
|
logger: Final = logging.getLogger(__name__)
|
13
13
|
|
14
|
-
compose_file: Final =
|
15
|
-
|
14
|
+
compose_file: Final = str(
|
15
|
+
resources.files("dao_treasury").joinpath("docker-compose.yaml")
|
16
16
|
)
|
17
17
|
"""The path of dao-treasury's docker-compose.yaml file on your machine"""
|
18
18
|
|
19
19
|
|
20
|
-
def up() -> None:
|
21
|
-
"""Build and start
|
20
|
+
def up(*services: str) -> None:
|
21
|
+
"""Build and start the specified containers defined in the compose file.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
services: service names to bring up.
|
22
25
|
|
23
26
|
This function first builds the Docker services by invoking
|
24
|
-
:func:`build` and then starts
|
27
|
+
:func:`build` and then starts the specified services in detached mode using
|
25
28
|
Docker Compose. If Docker Compose is not available, it falls back
|
26
29
|
to the legacy ``docker-compose`` command.
|
27
30
|
|
28
31
|
Examples:
|
32
|
+
>>> up('grafana')
|
33
|
+
starting the grafana container
|
29
34
|
>>> up()
|
30
|
-
starting
|
35
|
+
starting all containers (grafana and renderer)
|
31
36
|
|
32
37
|
See Also:
|
33
38
|
:func:`build`
|
@@ -35,10 +40,10 @@ def up() -> None:
|
|
35
40
|
:func:`_exec_command`
|
36
41
|
"""
|
37
42
|
# eth-portfolio containers must be started first so dao-treasury can attach to the eth-portfolio docker network
|
38
|
-
eth_portfolio_scripts.docker.up()
|
39
|
-
build()
|
40
|
-
print("starting the grafana
|
41
|
-
_exec_command(["up", "-d"])
|
43
|
+
eth_portfolio_scripts.docker.up("victoria-metrics")
|
44
|
+
build(*services)
|
45
|
+
print(f"starting the {', '.join(services) if services else 'grafana'} container(s)")
|
46
|
+
_exec_command(["up", "-d", *services])
|
42
47
|
|
43
48
|
|
44
49
|
def down() -> None:
|
@@ -57,7 +62,7 @@ def down() -> None:
|
|
57
62
|
_exec_command(["down"])
|
58
63
|
|
59
64
|
|
60
|
-
def build() -> None:
|
65
|
+
def build(*services: str) -> None:
|
61
66
|
"""Build Docker images for Grafana containers.
|
62
67
|
|
63
68
|
This function builds all services defined in the Docker Compose
|
@@ -73,7 +78,7 @@ def build() -> None:
|
|
73
78
|
:func:`_exec_command`
|
74
79
|
"""
|
75
80
|
print("building the grafana containers")
|
76
|
-
_exec_command(["build"])
|
81
|
+
_exec_command(["build", *services])
|
77
82
|
|
78
83
|
|
79
84
|
_P = ParamSpec("_P")
|
@@ -118,20 +123,20 @@ def ensure_containers(
|
|
118
123
|
# signal.signal(signal.SIGINT, down)
|
119
124
|
|
120
125
|
# start Grafana containers
|
121
|
-
up()
|
126
|
+
up("grafana")
|
122
127
|
|
123
128
|
try:
|
124
129
|
# attempt to run `fn`
|
125
|
-
await fn(*args, **kwargs)
|
130
|
+
return await fn(*args, **kwargs)
|
126
131
|
finally:
|
127
132
|
# stop and remove containers
|
128
133
|
# down()
|
129
|
-
|
134
|
+
pass
|
130
135
|
|
131
136
|
return compose_wrap
|
132
137
|
|
133
138
|
|
134
|
-
def _exec_command(command:
|
139
|
+
def _exec_command(command: List[str], *, compose_options: Tuple[str, ...] = ()) -> None:
|
135
140
|
"""Execute a Docker Compose command with system checks and fallback.
|
136
141
|
|
137
142
|
This internal function ensures that Docker and Docker Compose
|
Binary file
|
Binary file
|
Binary file
|