Redash: Can Python be used directly?

Created on 7 Jan 2018  路  4Comments  路  Source: getredash/redash

  1. Can I use Python pandas to manipulate data directly. If so, is there any example on this?

  2. Can I use Python visualization libraries (e.g., Bokeh or Plotly) for visualization directly?

question

Most helpful comment

Question: How to enable the Python Query Runner on the Docker release?

Answer: Edit docker-compose.production.yml and set in the environment: section:

REDASH_ADDITIONAL_QUERY_RUNNERS: "redash.query_runner.python"

PS: fixed the link https://github.com/getredash/redash/issues/2078

edit: found the answer

All 4 comments

Would be great to integrate Redash with Jupyter: have the query result be a cell input, and export cells as graphs for the dashboard.

@dclong It really depends. There are many workarounds. Here is one simple way to get pandas data frame (if you already have the necessary modules installed):

redash_query_results = get_query_result(1)
data = redash_query_results['rows'] # extract raw data from Redash query results

def redash_to_df(raw_data):
import pandas as pd
return pd.DataFrame.from_records(raw_data)

df = redash_to_df(data)

Also, check this very helpful functions on how to get the return dataframe to Redash data #2078

Question: How to enable the Python Query Runner on the Docker release?

Answer: Edit docker-compose.production.yml and set in the environment: section:

REDASH_ADDITIONAL_QUERY_RUNNERS: "redash.query_runner.python"

PS: fixed the link https://github.com/getredash/redash/issues/2078

edit: found the answer

i add python as data source to redash but when import mysql.connector module inside redash
get me this error
Error running query: 'module' object has no attribute 'connector'
how to solve it ??

Was this page helpful?
0 / 5 - 0 ratings