Skip to content

Commit

Permalink
Merge branch 'master' of github.com:apache/incubator-superset into DP…
Browse files Browse the repository at this point in the history
…TOOLS-1245
  • Loading branch information
betodealmeida committed Nov 8, 2018
2 parents 0dbaaf9 + 1fcfda4 commit 5e3d5a9
Show file tree
Hide file tree
Showing 372 changed files with 6,330 additions and 5,439 deletions.
2 changes: 2 additions & 0 deletions .flaskenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FLASK_APP=superset:app
FLASK_ENV=development
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
[BASIC]

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_,d,e,v,o,l,x,ts
good-names=i,j,k,ex,Run,_,d,e,v,o,l,x,ts,f

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata,d,fd
Expand Down Expand Up @@ -232,7 +232,7 @@ logging-modules=logging
[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO
notes=FIXME,XXX


[SIMILARITIES]
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ source venv/bin/activate

# Install external dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
# Install Superset in editable (development) mode
pip install -e .

Expand All @@ -221,8 +222,8 @@ superset init
# Load some data to play with
superset load_examples

# Start the Flask web server (but see below for frontend asset compilation)
superset runserver -d
# Start the Flask dev web server (but see below for frontend asset compilation)
flask run -p 8080 --with-threads --reload --debugger
```

#### Logging to the browser console
Expand Down Expand Up @@ -394,10 +395,10 @@ from flask_babel import lazy_gettext as _
then wrap our translatable strings with it, e.g. `_('Translate me')`. During extraction, string literals passed to `_` will be added to the generated `.po` file for each language for later translation.
At runtime, the `_` function will return the translation of the given string for the current language, or the given string itself if no translation is available.

In JavaScript, the technique is similar: we import `t` (simple translation), `tn` (translation containing a number), and `TCT` (translating entire React Components).
In JavaScript, the technique is similar: we import `t` (simple translation), `tn` (translation containing a number).

```javascript
import {t, tn, TCT} from locales;
import {t, tn } from '@superset-ui/translation';
```

### Enabling language selection
Expand Down
6 changes: 3 additions & 3 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Make sure these boxes are checked before submitting your issue - thank you!

- [ ] I have checked the superset logs for python stacktraces and included it here as text if any
- [ ] I have reproduced the issue with at least the latest released version of superset
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar
- [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ ] I have reproduced the issue with at least the latest released version of superset.
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar.


### Superset version
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ the world know they are using Superset. Join our growing community!
- [ScopeAI](https://www.getscopeai.com)
- [Shopee](https://shopee.sg)
- [Shopkick](https://www.shopkick.com)
- [Showmax](https://tech.showmax.com)
- [Tails.com](https://tails.com)
- [THEICONIC](http://theiconic.com.au/)
- [Tobii](http://www.tobii.com/)
Expand Down
8 changes: 6 additions & 2 deletions contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ENV LANG=C.UTF-8 \
HOME=/home/work

RUN apt-get update -y

#Install dependencies to fix `curl https support error` and `elaying package configuration warning`
RUN apt-get install -y apt-transport-https apt-utils
# Install some dependencies
# http://airbnb.io/superset/installation.html#os-dependencies
RUN apt-get update -y && apt-get install -y build-essential libssl-dev \
Expand All @@ -35,8 +36,11 @@ WORKDIR $HOME/incubator-superset

COPY ./ ./

RUN mkdir -p /home/work/.cache
RUN pip install --upgrade setuptools pip
RUN pip install -e . && pip install -r requirements-dev.txt
RUN pip install -r requirements.txt
RUN pip install -r requirements-dev.txt
RUN pip install -e .

ENV PATH=/home/work/incubator-superset/superset/bin:$PATH \
PYTHONPATH=./superset/:$PYTHONPATH
Expand Down
2 changes: 1 addition & 1 deletion contrib/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -ex
if [ "$#" -ne 0 ]; then
exec "$@"
elif [ "$SUPERSET_ENV" = "local" ]; then
superset runserver -d
flask run -p 8080 --with-threads --reload --debugger --host=0.0.0.0
elif [ "$SUPERSET_ENV" = "production" ]; then
superset runserver -a 0.0.0.0 -w $((2 * $(getconf _NPROCESSORS_ONLN) + 1))
else
Expand Down
4 changes: 2 additions & 2 deletions contrib/docker/docker-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ cd superset/assets && npm run build && cd ../../
# Start superset worker for SQL Lab
superset worker &

# To start a development web server, use the -d switch
superset runserver -d
# Start the dev web server
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
6 changes: 0 additions & 6 deletions contrib/docker/superset_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os


Expand Down
10 changes: 5 additions & 5 deletions docs/druid.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Druid
=====

Superset has a native connector to Druid, and a majority of Druid's
Superset has a native connector to Druid and a majority of Druid's
features are accessible through Superset.

.. note ::
Druid now supports SQL and can be accessed through Superset's
SQLAlchemy connector. The long term vision is to deprecate
SQLAlchemy connector. The long-term vision is to deprecate
the Druid native REST connector and query Druid exclusively through
the SQL interface.
Aggregations
------------

Common aggregations, or Druid metrics can be defined and used in Superset.
Common aggregations or Druid metrics can be defined and used in Superset.
The first and simpler use case is to use the checkbox matrix expose in your
datasource's edit view (``Sources -> Druid Datasources ->
[your datasource] -> Edit -> [tab] List Druid Column``).
Clicking the ``GroupBy`` and ``Filterable`` checkboxes will make the column
appear in the related dropdowns while in explore view. Checking
``Count Distinct``, ``Min``, ``Max`` or ``Sum`` will result in creating
new metrics that will appear in the ``List Druid Metric`` tab upon saving the
datasource. By editing these metrics, you'll notice that they their ``json``
element correspond to Druid aggregation definition. You can create your own
datasource. By editing these metrics, you'll notice that their ``json``
element corresponds to Druid aggregation definition. You can create your own
aggregations manually from the ``List Druid Metric`` tab following Druid
documentation.

Expand Down
4 changes: 2 additions & 2 deletions docs/import_export_datasources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ By default, default (null) values will be omitted. Use the ``-d`` flag to includ
If you want back references to be included (e.g. a column to include the table id
it belongs to) use the ``-b`` flag.

Alternatively you can export datasources using the UI:
Alternatively, you can export datasources using the UI:

1. Open **Sources** -> **Databases** to export all tables associated to a
single or multiple databases. (**Tables** for one or more tables,
Expand Down Expand Up @@ -95,7 +95,7 @@ those would be synchronised as well.


If you don't supply the sync flag (``-s``) importing will only add and update (override) fields.
E.g. you can add a ``verbose_name`` to the the column ``ds`` in the table ``random_time_series`` from the example datasets
E.g. you can add a ``verbose_name`` to the column ``ds`` in the table ``random_time_series`` from the example datasets
by saving the following YAML to file and then running the ``import_datasources`` command. ::

databases:
Expand Down
68 changes: 34 additions & 34 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ flexible and lets you choose your web server (Gunicorn, Nginx, Apache),
your metadata database engine (MySQL, Postgres, MariaDB, ...),
your message queue (Redis, RabbitMQ, SQS, ...),
your results backend (S3, Redis, Memcached, ...), your caching layer
(memcached, Redis, ...), works well with services like NewRelic, StatsD and
(Memcached, Redis, ...), works well with services like NewRelic, StatsD and
DataDog, and has the ability to run analytic workloads against
most popular database technologies.

Expand Down Expand Up @@ -65,7 +65,7 @@ OS dependencies

Superset stores database connection information in its metadata database.
For that purpose, we use the ``cryptography`` Python library to encrypt
connection passwords. Unfortunately this library has OS level dependencies.
connection passwords. Unfortunately, this library has OS level dependencies.

You may want to attempt the next step
("Superset installation and initialization") and come back to this step if
Expand All @@ -82,7 +82,7 @@ the required dependencies are installed: ::

sudo apt-get install build-essential libssl-dev libffi-dev python3.5-dev python-pip libsasl2-dev libldap2-dev

otherwhise build for ``cryptography`` fails.
otherwise build for ``cryptography`` fails.

For **Fedora** and **RHEL-derivatives**, the following command will ensure
that the required dependencies are installed: ::
Expand Down Expand Up @@ -138,7 +138,7 @@ Follow these few simple steps to install Superset.::
# Install superset
pip install superset

# Create an admin user (you will be prompted to set username, first and last name before setting a password)
# Create an admin user (you will be prompted to set a username, first and last name before setting a password)
fabmanager create-admin --app superset

# Initialize the database
Expand Down Expand Up @@ -173,22 +173,22 @@ application in a way that works well in your environment. Here's an **async**
setup known to work well in production: ::

 gunicorn \
-w 10 \
-k gevent \
--timeout 120 \
-b 0.0.0.0:6666 \
--limit-request-line 0 \
--limit-request-field_size 0 \
--statsd-host localhost:8125 \
superset:app
-w 10 \
-k gevent \
--timeout 120 \
-b 0.0.0.0:6666 \
--limit-request-line 0 \
--limit-request-field_size 0 \
--statsd-host localhost:8125 \
superset:app

Refer to the
`Gunicorn documentation <http://docs.gunicorn.org/en/stable/design.html>`_
for more information.

Note that *gunicorn* does not
work on Windows so the `superset runserver` command is not expected to work
in that context. Also note that the development web
in that context. Also, note that the development web
server (`superset runserver -d`) is not intended for production use.

If not using gunicorn, you may want to disable the use of flask-compress
Expand All @@ -197,9 +197,9 @@ by setting `ENABLE_FLASK_COMPRESS = False` in your `superset_config.py`
Flask-AppBuilder Permissions
----------------------------

By default every time the Flask-AppBuilder (FAB) app is initialized the
By default, every time the Flask-AppBuilder (FAB) app is initialized the
permissions and views are added automatically to the backend and associated with
the ‘Admin’ role. The issue however is when you are running multiple concurrent
the ‘Admin’ role. The issue, however, is when you are running multiple concurrent
workers this creates a lot of contention and race conditions when defining
permissions and views.

Expand All @@ -224,7 +224,7 @@ If you are running superset behind a load balancer or reverse proxy (e.g. NGINX
or ELB on AWS), you may need to utilise a healthcheck endpoint so that your
load balancer knows if your superset instance is running. This is provided
at ``/health`` which will return a 200 response containing "OK" if the
webserver is running.
the webserver is running.

If the load balancer is inserting X-Forwarded-For/X-Forwarded-Proto headers, you
should set `ENABLE_PROXY_FIX = True` in the superset config file to extract and use
Expand Down Expand Up @@ -358,7 +358,7 @@ Here's a list of some of the recommended packages.
| Teradata | ``pip install sqlalchemy-teradata`` | ``teradata://`` |
+---------------+-------------------------------------+-------------------------------------------------+

Note that many other database are supported, the main criteria being the
Note that many other databases are supported, the main criteria being the
existence of a functional SqlAlchemy dialect and Python driver. Googling
the keyword ``sqlalchemy`` in addition of a keyword that describes the
database you want to connect to should get you to the right place.
Expand Down Expand Up @@ -442,11 +442,11 @@ into your global default defined in ``CACHE_CONFIG``.
.. code-block:: python
CACHE_CONFIG = {
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, # 1 day default (in secs)
'CACHE_KEY_PREFIX': 'superset_results',
'CACHE_REDIS_URL': 'redis://localhost:6379/0',
}
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, # 1 day default (in secs)
'CACHE_KEY_PREFIX': 'superset_results',
'CACHE_REDIS_URL': 'redis://localhost:6379/0',
}
Expand All @@ -470,7 +470,7 @@ while the ``metadata_params`` get unpacked into the
Schemas (Postgres & Redshift)
-----------------------------

Postgres and Redshift, as well as other database,
Postgres and Redshift, as well as other databases,
use the concept of **schema** as a logical entity
on top of the **database**. For Superset to connect to a specific schema,
there's a **schema** parameter you can set in the table form.
Expand Down Expand Up @@ -596,9 +596,9 @@ On large analytic databases, it's common to run queries that
execute for minutes or hours.
To enable support for long running queries that
execute beyond the typical web request's timeout (30-60 seconds), it is
necessary to configure an asynchronous backend for Superset which consist of:
necessary to configure an asynchronous backend for Superset which consists of:

* one or many Superset worker (which is implemented as a Celery worker), and
* one or many Superset workers (which is implemented as a Celery worker), and
can be started with the ``celery worker`` command, run
``celery worker --help`` to view the related options.
* a celery broker (message queue) for which we recommend using Redis
Expand Down Expand Up @@ -651,7 +651,7 @@ This means that SQLite will not work in this context since it has
limited support for concurrency and
typically lives on the local file system.

Also note that SQL Lab supports Jinja templating in queries, and that it's
Also note that SQL Lab supports Jinja templating in queries and that it's
possible to overload
the default Jinja context in your environment by defining the
``JINJA_CONTEXT_ADDONS`` in your superset configuration. Objects referenced
Expand Down Expand Up @@ -686,7 +686,7 @@ Blueprints
`Blueprints are Flask's reusable apps <http://flask.pocoo.org/docs/0.12/blueprints/>`_.
Superset allows you to specify an array of Blueprints
in your ``superset_config`` module. Here's
an example on how this can work with a simple Blueprint. By doing
an example of how this can work with a simple Blueprint. By doing
so, you can expect Superset to serve a page that says "OK"
at the ``/simple_page`` url. This can allow you to run other things such
as custom data visualization applications alongside Superset, on the
Expand Down Expand Up @@ -739,7 +739,7 @@ Note that the above command will install Superset into ``default`` namespace of
Custom OAuth2 configuration
---------------------------

Beyond FAB supported providers (github, twitter, linkedin, google, azure), its easy to connect Superset with other OAuth2 Authorization Server implementations that supports "code" authorization.
Beyond FAB supported providers (github, twitter, linkedin, google, azure), its easy to connect Superset with other OAuth2 Authorization Server implementations that support "code" authorization.

The first step: Configure authorization in Superset ``superset_config.py``.

Expand All @@ -756,11 +756,11 @@ The first step: Configure authorization in Superset ``superset_config.py``.
'request_token_params':{
'scope': 'read' # Scope for the Authorization
},
'access_token_method':'POST', # HTTP Method to call access_token_url
'access_token_params':{ # Additional parameters for calls to access_token_url
'client_id':'myClientId'
'access_token_method':'POST', # HTTP Method to call access_token_url
'access_token_params':{ # Additional parameters for calls to access_token_url
'client_id':'myClientId'
},
'access_token_headers':{ # Additional headers for calls to access_token_url
'access_token_headers':{ # Additional headers for calls to access_token_url
'Authorization': 'Basic Base64EncodedClientIdAndSecret'
},
'base_url':'https://myAuthorizationServer/oauth2AuthorizationServer/',
Expand Down Expand Up @@ -788,11 +788,11 @@ Second step: Create a `CustomSsoSecurityManager` that extends `SupersetSecurityM
logging.debug("Oauth2 provider: {0}.".format(provider))
if provider == 'egaSSO':
# As example, this line request a GET to base_url + '/' + userDetails with Bearer Authentication,
# and expects that authorization server checks the token, and response with user details
# and expects that authorization server checks the token, and response with user details
me = self.appbuilder.sm.oauth_remotes[provider].get('userDetails').data
logging.debug("user_data: {0}".format(me))
return { 'name' : me['name'], 'email' : me['email'], 'id' : me['user_name'], 'username' : me['user_name'], 'first_name':'', 'last_name':''}
...
...
This file must be located at the same directory than ``superset_config.py`` with the name ``custom_sso_security_manager.py``.

Expand Down
Loading

0 comments on commit 5e3d5a9

Please sign in to comment.