Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Superset config.py on

I am trying to customising my Apache Superset. I am not very familiar with Terminal.

On the documentation it is written: "To configure your application, you need to create a file (module) superset_config.py and make sure it is in your PYTHONPATH. Here are some of the parameters you can copy / paste in that configuration module:".

Let's say I want to decrease ROW_LIMIT to 5000, and my Superset is installed on an Anaconda Environment called "ExperimentSuperset". Can someone please explain to me what do I have to do to reach this results ?

Thanks a lot !

like image 664
Simone Zanetti Avatar asked Dec 05 '19 12:12

Simone Zanetti


2 Answers

The pythonpath is mainly defined by:

  1. execution directory
  2. pythonpath environemnt variable
  3. default install dir for modules

(Also it can be enhanced using sys.path and pth file - which definesdirectories and itself needs to be in python).

To my experience, pythonpath variable is set by most superset applications and can be evaluated the simplest way by calling set in console or echo $pythonpath. You can also use python to print out the pythonpath from terminal: python -c "import sys; print('\n'.join(sys.path))".

Superset looks in the path for a file called superset_config.py there. You can also directly point to the file even if it is not in the path when you set the environment variable SUPERSET_CONFIG_PATH=/your/path/to/superset_config.py.

In the sources there's a file called config.py that has all settings. All settings there will be overwritten with the settings loaded from superset_config.py. So you just need to define the specifics of your superset application.

So your specific steps are:

  1. create a new and empty superset_config.py
  2. add ROW_LIMIT = 5000 to file
  3. make sure it's in python path or set environment variable SUPERSET_CONFIG_PATH

Superset will then use the config file and read your settings. Noite the config is a fully functional python file, so you can add methods etc. In the superset example there's a useful method pulling parameters in from environment variables. This is especially useful when using e.g. Docker.

like image 102
supernova Avatar answered Sep 20 '22 20:09

supernova


At the end of config.py you'll see that it tries to load superset_config.py from SUPERSET_CONFIG_PATH so all you need to do is:

  1. Create the file
  2. Set the values you want there (ROW_LIMIT = 5000)
  3. Run this command:
export SUPERSET_CONFIG_PATH=/path/to/your/superset_config.py

  1. Restart your superset to take the changes

Source: https://github.com/apache/superset/issues/2117#issuecomment-277666183

like image 32
rvazquezglez Avatar answered Sep 23 '22 20:09

rvazquezglez