Created
May 26, 2026 01:57
-
-
Save jorinvo/afae84a0ef12701e733c7d465b257617 to your computer and use it in GitHub Desktop.
download_dashboard.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALL http_client FROM community; | |
| LOAD http_client; | |
| -- Generate key with `dashboard:read` permission in Admin UI | |
| SET VARIABLE shaperkey = 'myshaperkey'; | |
| -- Returns file as BLOB | |
| CREATE TEMP MACRO download_dashboard(id, ext) AS | |
| (SELECT content FROM read_blob(concat('http://localhost:5454', http_get( | |
| concat('http://localhost:5454/api/dashboards/', id, '/download/result.', ext, '?mode=url'), | |
| headers => MAP { | |
| 'Authorization': concat('Bearer ', getvariable('shaperkey')), | |
| 'Accept': 'application/json' | |
| }, | |
| MAP {} | |
| )->>'body'->>'url'))); | |
| SELECT download_dashboard('mydashboardid', 'pdf'); | |
| SELECT download_dashboard('mydashboardid', 'png'); | |
| SELECT download_dashboard('mydashboardid', 'xlsx'); | |
| SELECT download_dashboard('mydashboardid', 'csv'); | |
| SELECT download_dashboard('mydashboardid', 'json'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment