Skip to content

Commit 7cdf114

Browse files
committed
add dashboard for extension downloads
1 parent 941b8dc commit 7cdf114

File tree

6 files changed

+57
-2
lines changed

6 files changed

+57
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.duckdb
22
*.wal
33
.env
4+
.vscode
45
/evidence/.evidence/customization/.profile.json

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ Therfore (for now) there are 2 build steps:
7070

7171
Steps to define a new source:
7272
- initial step to create a new source, see: https://docs.evidence.dev/core-concepts/data-sources/duckdb/
73-
- update `./scripts/generate_sources.sh` to make sure a `.duckdb` is created in this subdirectory with all data required for the dashboard
73+
- run `make dev` to spawn the front-end
74+
- following the steps in the link above will create a subdirectory under `./evidence/sources`
75+
- update `./scripts/generate_sources.sh` to make sure a `.duckdb` file is created in this subdirectory with all data required for the dashboard
7476
- add one or more `.sql` files to select the data relevant for the dashboard
7577

7678

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Extension Downloads
3+
---
4+
5+
```sql extensions
6+
select
7+
extension_name as extension
8+
from extension_downloads.extension_downloads
9+
group by extension
10+
order by extension
11+
```
12+
<Dropdown data={extensions} name=extension value=extension>
13+
<DropdownOption value="%" valueLabel="All Extensions"/>
14+
</Dropdown>
15+
16+
<Dropdown name=year>
17+
<DropdownOption value=2025/>
18+
<DropdownOption value=2024/>
19+
</Dropdown>
20+
21+
22+
```sql extension_downloads
23+
select
24+
week,
25+
downloads,
26+
extension_name as extension
27+
from extension_downloads.extension_downloads
28+
where year = ${inputs.year.value}
29+
and extension like '${inputs.extension.value}'
30+
group by all
31+
order by extension desc
32+
```
33+
34+
<BarChart
35+
data={extension_downloads}
36+
title="Extension Downloads per week, {inputs.extension.label}"
37+
x=week
38+
y=downloads
39+
series=extension
40+
/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was automatically generated
2+
name: extension_downloads
3+
type: duckdb
4+
options:
5+
filename: extension_downloads.duckdb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
select * from extension_downloads

scripts/generate_sources.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ -z "$DUCKLAKE_USER" ]; then echo "Error: DUCKLAKE_USER is not set."
1515
if [ -z "$DUCKLAKE_DB_PASSWORD" ]; then echo "Error: DUCKLAKE_DB_PASSWORD is not set."; exit 1; fi
1616

1717

18-
duckdb ./evidence/sources/ci_metrics/ci_metrics.duckdb -c "
18+
duckdb -c "
1919
INSTALL ducklake;
2020
INSTALL postgres;
2121
@@ -34,7 +34,13 @@ ATTACH 'ducklake:postgres:dbname=ducklake_catalog
3434
AS my_ducklake
3535
(DATA_PATH '$DUCKLAKE_S3_BUCKET', READ_ONLY);
3636
37+
ATTACH './evidence/sources/ci_metrics/ci_metrics.duckdb' AS ci_workflows_db;
38+
USE ci_workflows_db;
3739
CREATE OR REPLACE TABLE ci_workflows AS FROM my_ducklake.ci_workflows;
3840
CREATE OR REPLACE TABLE ci_runs AS FROM my_ducklake.ci_runs;
3941
CREATE OR REPLACE TABLE ci_jobs AS FROM my_ducklake.ci_jobs;
42+
43+
ATTACH './evidence/sources/extension_downloads/extension_downloads.duckdb' AS extension_downloads_db;
44+
USE extension_downloads_db;
45+
CREATE OR REPLACE TABLE extension_downloads AS FROM my_ducklake.extension_downloads;
4046
"

0 commit comments

Comments
 (0)