Search code examples
sqlitesqlalchemyapache-superset

How do I reset Superset's db?


I've been testing stuff out with Superset and I think I corrupted my superset db. When I try to acess any chart i get this error:

sqlalchemy error: dbs.perm not found

I found a workaround to this problem, by searching with ag - the silver searcher which individual migration dropped the dbs.perm table, and using the command

superset db downgrade <migration-id>

on the migration prior to that one.

It's still not very clear to me which steps I would take as to completely reset the db safely.

I have the manual, dev installation since I'm working on customizing the code. Let's say I didn't have anything too important in the db, so I'm not afraid to loose tables, users, perms, etc.

I've found I have a superset.db in ~/.superset, but I don't think deleting that will be enough, right?

How can I reset Superset's db so as to make a clean db and start over? Can I do this without losing my Superset installation, or do I need to start over completely? In any case, can you guide me through it?


Solution

  • You need not to reinstall everything. Just remove the ~/.superset/superset.db file and take the backup of this file before removing it just in case you want to restore it. and then run the below commands. These commands will create another database file.

    Initialize the database

    superset db upgrade

    Create an admin user (you will be prompted to set a username, and first and last name before setting a password)

    $ export FLASK_APP=superset
    $ superset fab create-admin
    

    Load some data to play with

    superset load_examples

    Create default roles and permissions

    superset init