mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-08 21:34:25 +00:00
chore(redash): start knowledge base article
This commit is contained in:
135
knowledge base/redash.md
Normal file
135
knowledge base/redash.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# Redash
|
||||||
|
|
||||||
|
> TODO
|
||||||
|
|
||||||
|
Intro
|
||||||
|
|
||||||
|
<!-- Remove this line to uncomment if used
|
||||||
|
## Table of contents <!-- omit in toc -->
|
||||||
|
|
||||||
|
1. [TL;DR](#tldr)
|
||||||
|
1. [API](#api)
|
||||||
|
1. [Further readings](#further-readings)
|
||||||
|
1. [Sources](#sources)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
<!-- Uncomment if used
|
||||||
|
<details>
|
||||||
|
<summary>Setup</summary>
|
||||||
|
|
||||||
|
```sh
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Uncomment if used
|
||||||
|
<details>
|
||||||
|
<summary>Usage</summary>
|
||||||
|
|
||||||
|
```sh
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Uncomment if used
|
||||||
|
<details>
|
||||||
|
<summary>Real world use cases</summary>
|
||||||
|
|
||||||
|
```sh
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
-->
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Refer [API].
|
||||||
|
|
||||||
|
Prefer acting on them via [getredash/redash-toolbelt].
|
||||||
|
|
||||||
|
<details style='padding: 0 0 1rem 1rem'>
|
||||||
|
<summary>Data sources</summary>
|
||||||
|
|
||||||
|
```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)
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Further readings
|
||||||
|
|
||||||
|
- [Website]
|
||||||
|
- [Codebase]
|
||||||
|
|
||||||
|
### Sources
|
||||||
|
|
||||||
|
- [Documentation]
|
||||||
|
- [API]
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Reference
|
||||||
|
═╬═Time══
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- In-article sections -->
|
||||||
|
<!-- Knowledge base -->
|
||||||
|
<!-- Files -->
|
||||||
|
<!-- Upstream -->
|
||||||
|
[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
|
||||||
|
|
||||||
|
<!-- Others -->
|
||||||
@@ -7,6 +7,20 @@
|
|||||||
curl 'ipconfig.io'
|
curl 'ipconfig.io'
|
||||||
curl -fs 'https://ipconfig.io/json' | jq -r '.ip' -
|
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.
|
# Use different names.
|
||||||
# Kinda like '--resolve' but to aliases and supports ports.
|
# 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 -v --cookie "USER_TOKEN=Yes" http://127.0.0.1:5000/
|
||||||
|
|
||||||
|
curl --head --url 'localhost:5000/healthz'
|
||||||
|
curl -I 'localhost:5000/healthz'
|
||||||
|
|||||||
Reference in New Issue
Block a user