Write only the main points.
Drop the redash image locally with dockerpull and start it.
docker pull redash/redash
After that, create docker-compose.yml (REDASH_ADDITIONAL_QUERY_RUNNERS is set so that python can be used)
version: '2'
services:
server:
image: redash/redash:latest
command: server
depends_on:
- postgres
- redis
ports:
- "5000:5000"
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
REDASH_COOKIE_SECRET: veryverysecret
REDASH_ADDITIONAL_QUERY_RUNNERS: "redash.query_runner.python"
worker:
image: redash/redash:latest
command: scheduler
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
REDASH_ADDITIONAL_QUERY_RUNNERS: "redash.query_runner.python"
QUEUES: "queries,scheduled_queries,celery"
WORKERS_COUNT: 2
redis:
image: redis:3.0-alpine
postgres:
image: postgres:9.5.6-alpine
volumes:
- /opt/postgres-data:/var/lib/postgresql/data
nginx:
image: redash/nginx:latest
ports:
- "80:80"
depends_on:
- server
links:
- server:redash
docker-compose up
docker-compose up
Then log in to redash and set the following in your postgres data source
Here's how to set up a python data source. Write Modules to import prior to running the script separated by commas if there is something to import.
Then, select python for datasource and enter the following in query creation
query='\
select \
count(*) AS count \
from queries \
'
values = execute_query('postgres', query)['rows']
add_result_row(result, {'name': 'result', 'count': values[0]['count']})
add_result_column(result, 'name', '', 'date')
add_result_column(result, 'count', '', 'date')
You can output the result by pressing Execute.
Don't make various reports by combining google spreadsheet, DB, GA, etc. I can go, I can go.
Recommended Posts