- Querying (events by date example)
- Save
- Fork
- Refresh schedule
- Auto complete
- Schema (updated every 30 minutes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import gzip | |
from tqdm import tqdm | |
import click | |
import json | |
try: | |
from redash import models | |
from redash.utils import json_dumps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rows":[ | |
{ | |
"_id":"CA", | |
"totalPop":29754890 | |
}, | |
{ | |
"_id":"NY", | |
"totalPop":17990402 | |
} |
Each user in the system has one group or more he is member of. These groups are used to assign permissions to this user. I will add the option to set a datasource to belong to one or more groups. This will mean, that a user who is a member of this group, will have access to the datasources that belong to this group.
In technical terms: have a many to many relationship between groups and datasources. And have a calculated property on the User class, that will return the list of data sources he has access to.
Next we need to enforce this restriction:
- In the datasources list API call, we will filter out the ones the user don't have access to. Or as an alternative: ask for the ones he has access to, and return only them.
- For all queries and query results related API calls, we will check if the current user has access to the given query (based on the data source it belongs to), and if not, won't return it or filter it out from a group of queries.
- For all dashboard/widgets/visualization APIs, do the sam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get existing queries results | |
users = get_query_result(132) # this one has {id, name} | |
events_by_users = get_query_result(131) # this one has {user_id, events count} | |
# actual merging. can be replaced with helper function and/or some Pandas code | |
events_dict = {} | |
for row in events_by_users['rows']: | |
events_dict[row['user_id']] = row['count'] | |
for row in users['rows']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[supervisord] | |
nodaemon=false | |
logfile=/opt/redash/logs/supervisord.log | |
pidfile=/opt/redash/supervisord/supervisord.pid | |
directory=/opt/redash/current | |
[inet_http_server] | |
port = 127.0.0.1:9001 | |
[rpcinterface:supervisor] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream redash_servers { | |
server 127.0.0.1:5000; | |
} | |
server { | |
listen [::]:80; | |
listen 443 default_server ssl; | |
# Make sure to set paths to your certificate .pem and .key files. | |
ssl_certificate /path-to/cert.pem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: ts=4:sw=4:expandtab:autoindent: | |
import os | |
import sys | |
import requests | |
import filecmp | |
from fabric.context_managers import hide, settings, prefix | |
from fabric.api import sudo, task, run, cd, env | |
from fabric.contrib.console import confirm | |
from fabric.colors import green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twitter # python-twitter | |
import csv | |
import cStringIO | |
import codecs | |
from requests_oauthlib import OAuth1Session | |
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' | |
ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' | |
AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' | |
SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' |