Incubator-superset: Change the setting of superset from sqlite to MySQL - a problem!

Created on 24 Mar 2017  路  15Comments  路  Source: apache/incubator-superset

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

Superset version

version: 0.17.1

Hey.
I want to change the standard database configuration from sqlite to mysql.

  1. Added its configuration file superset_config.py and put it in PYTHONPATH
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 200000
SUPERSET_WORKERS = 4

SUPERSET_WEBSERVER_PORT = 8088
#---------------------------------------------------------

#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1t567fgj7dtghjdhfui64@#$&77cvw424tkey\1\2\e\y\y\h'

# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
#SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db'
SQLALCHEMY_DATABASE_URI = 'mysql://superset:32rasdf356ytsdfDD@localhost/superset'

# Flask-WTF flag for CSRF
CSRF_ENABLED = True

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''

  1. I'm executing the code
    Fabmanager create-admin --app superset

In my database mysql, tables have been added, as well as 1 user admin.

default

  1. Then I execute the code:
    Superset db upgrade

At this point, the sqlite database is created! Why?
default

default

  1. Then I execute the code:
    Superset init

And the changes are again happening in the database sqlite ! Why?
default

Thank you.

Most helpful comment

export SUPERSET_CONFIG_PATH=superset/superset_config.py
work for me

All 15 comments

export PYTHONPATH=$WHEREYOURCONFIGIS:$PYTHONPATH

should do the trick, where of course WHEREYOURCONFIGIS is the path of the superset_config with the mysql database.

I think there is something wrong with the latest (pip) version of superset.
I had it working with psql and after a recent deploy that installed the latest superset it stopped working.
I rolled back to version 0.15.4 and it works again.

Edit: My config file was in my PYTHONPATH

@jasondscott: you had superset installed on postgresql?

Anyway superset_config.py work fine here with latest master to override the db, fails badly with the options read by the cli though.

@xrmx Yes superset is installed on postgresql. Is that a problem?

To debug you can fire up ipython, run import superset_config and type superset_config? and it will print the location of your superset_config module. This needs to happen in the same context/environment as where you start the web server process from.

Whatever the problem was I think its been addressed. Closing

@jasondscott is this solved?

I am running superset 0.19.0 and installed it from pip with Python 3.4.5. However, I faced the same issue as this while I am using postgresql.

If it is solved, how did you solve it?

Oh solved the problem by export PYTHONPATH="/home/user/superset/:$PYTHONPATH".

Initially, I was using export PYTHONPATH="/home/user/superset:$PYTHONPATH". .. one simple / solved the problem :)

after removing ~/.superset/superset.db, it works

so that it works for me, change the variable also in the config.py file (/usr/local/lib/pythonX.X/site-packages/config.py)

export SUPERSET_CONFIG_PATH=superset/superset_config.py
work for me

It seems that when i use Python 3.6.6 and try to add mysql instead of sqlite i get error : Was unable to import superset Error: No module named 'MySQLdb'. There is no MySQLdb for python 3+.Has Anyone faced this issue?

bump

export SUPERSET_CONFIG_PATH=superset/superset_config.py

worked for me thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thoralf-gutierrez picture thoralf-gutierrez  路  3Comments

josephtyler picture josephtyler  路  3Comments

john-bodley picture john-bodley  路  3Comments

sashank picture sashank  路  3Comments

kalimuthu123 picture kalimuthu123  路  3Comments