From ae550cad83fdbbb4bb07e15b66622b9cdcff1d07 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 8 Jan 2026 23:39:36 +0100 Subject: [PATCH] chore(redash): start knowledge base article --- knowledge base/redash.md | 135 +++++++++++++++++++++++++++++++++++++++ snippets/curl.sh | 17 +++++ 2 files changed, 152 insertions(+) create mode 100644 knowledge base/redash.md diff --git a/knowledge base/redash.md b/knowledge base/redash.md new file mode 100644 index 0000000..3ed2acc --- /dev/null +++ b/knowledge base/redash.md @@ -0,0 +1,135 @@ +# Redash + +> TODO + +Intro + + + +1. [TL;DR](#tldr) +1. [API](#api) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + + + + + + + +## API + +Refer [API]. + +Prefer acting on them via [getredash/redash-toolbelt]. + +
+ Data sources + +```plaintext +GET /api/data_sources +GET /api/data_sources/42 + +POST /api/data_sources +{ + "name": "some data source", + "type": "pg", + "options": { + "host": "db.fqdn", + "port": 5432, + "dbname": "postgres", + "user": "postgres", + "password": "someStr0ngPa$$w0rd", + } +} +``` + +```sh +curl --request 'GET' --url 'https://redash.example.org/api/data_sources' --header 'Authorization: Key AA…99' + +curl --request 'POST' --url 'https://redash.example.org/api/data_sources' --header 'Authorization: Key AA…99' \ + --data '{ + "name": "some data source", + "type": "pg", + "options": { + "host": "db.fqdn", + "port": 5432, + "dbname": "postgres", + "user": "postgres", + "password": "someStr0ngPa$$w0rd", + } + }' +``` + +```py +from redash_toolbelt import Redash +from requests import Response + +data_source_name: str = 'some data source' +data_source_type: str = 'pg' +data_source_options: object = { + host = 'db.fqdn', + port = 5432, # must be int + dbname = 'postgres', + user = 'postgres', + password = 'someStr0ngPa$$w0rd', +} + +response: Response = redash.create_data_source(data_source_name, data_source_type, data_source_options) +``` + +
+ +## Further readings + +- [Website] +- [Codebase] + +### Sources + +- [Documentation] +- [API] + + + + + + + +[API]: https://redash.io/help/user-guide/integrations-and-api/api/ +[Codebase]: https://github.com/getredash/redash +[Documentation]: https://redash.io/help/ +[Website]: https://redash.io/ +[getredash/redash-toolbelt]: https://github.com/getredash/redash-toolbelt + + diff --git a/snippets/curl.sh b/snippets/curl.sh index bf305e4..c6f40b1 100644 --- a/snippets/curl.sh +++ b/snippets/curl.sh @@ -7,6 +7,20 @@ curl 'ipconfig.io' curl -fs 'https://ipconfig.io/json' | jq -r '.ip' - +# Specify data for the request +curl --request 'POST' --url 'https://redash.example.org/api/data_sources' --header 'Authorization: Key aa…00' \ + --data '{ + "name": "Some PostgreSQL Data Source", + "type": "pg", + "options": { + "host": "db.example.org", + "port": 5432, + "dbname": "postgres", + "user": "redash", + "password": "SomeStr0ngPa$$word" + } + }' +curl -X 'POST' 'https://redash.example.org/api/data_sources' -H 'Authorization: Key aa…00' -d '{…}' # Use different names. # Kinda like '--resolve' but to aliases and supports ports. @@ -29,3 +43,6 @@ curl --fail --silent --request 'PUT' 'https://gitlab.com/api/v4/runners/{}' \ curl -v --cookie "USER_TOKEN=Yes" http://127.0.0.1:5000/ + +curl --head --url 'localhost:5000/healthz' +curl -I 'localhost:5000/healthz'