These are chat archives for getredash/redash

31st
Aug 2016
snirad
@snirad
Aug 31 2016 07:27
I probabbly missed something with string concatenation
I don't usually write in python but it works
        qid = query.id
        headers = { "authorization": "Token" }
        url =  "http://{host}/api/queries/{qid}/results.json".format(qid=qid,host=host)
        myrep=requests.get(url,headers=headers)
        data = json.loads(myrep.text)
        retrieved_at = data.get('query_result').get('retrieved_at')
        query_select = data.get('query_result').get('query')
        count_key = (data.get('query_result').get('data').get('rows')[0]).keys()[0]
        count = data.get('query_result').get('data').get('rows')[0].get(count_key)
        html = """
        ########################### Pretty Redash Mail ########################### <br/>
        Alert Name : {alert_name} <br/>
        Select : {query_select} <br/>
        Retrieved At : {retrieved_at} <br/>
        Value :<mark>{count}</mark> <br/>
        Threshold : {alert_value} <br/>
        Rearm Value : {rearm} <br/>
        ########################### Pretty Redash Mail ########################### <br/>
        Check <a href="{host}/alerts/{alert_id}">alert</a> Check <a href="{host}/queries/{query_id}">query </a>
        """.format(host=host, alert_id=alert.id, query_id=query.id
                   ,count=count
                   ,rearm=alert.rearm
                   ,retrieved_at=retrieved_at
                   ,query_select=query_select
                   ,alert_value=alert.options["value"]
                   ,alert_name=alert.name)
Arik Fraimovich
@arikfr
Aug 31 2016 14:35
You can write it in any language you feel more comfortable with. It's a simple HTTP GET request.
Kurt Gooden
@kurtgooden_twitter
Aug 31 2016 15:48
Having some issues getting ReDash to authenticate against a Google Sheet attached as federated table in BigQuery. Tried many iterations of adding service account to sheet and dataset. Is there a specific version that supports this or am I missing something?
Arik Fraimovich
@arikfr
Aug 31 2016 18:41
@kurtgooden_twitter from some research I did, looks like we need to update the BigQuery query runner to support Google Sheets backed tables.
Kurt Gooden
@kurtgooden_twitter
Aug 31 2016 21:23
Thanks! Was able to make the edit myself. Maybe we can submit a patch. Tiny tweak, works great.