From 838ad32c15229a36587646528da06d5775a6affd Mon Sep 17 00:00:00 2001 From: Bogdan Kyryliuk Date: Wed, 15 Feb 2017 07:51:04 -0800 Subject: [PATCH] Add command to refresh datasources --- superset/cli.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/superset/cli.py b/superset/cli.py index e7d4b1a93b027..04d4b7e3b2929 100755 --- a/superset/cli.py +++ b/superset/cli.py @@ -149,6 +149,19 @@ def refresh_druid(datasource, merge): session.commit() +@manager.command +def update_datasources_cache(): + """Refresh sqllab datasources cache""" + from superset import models + for database in db.session.query(models.Database).all(): + print('Fetching {} datasources ...'.format(database.name)) + try: + database.all_table_names() + database.all_view_names() + except Exception as e: + print('{}'.format(e.message)) + + @manager.option( '-w', '--workers', default=config.get("SUPERSET_CELERY_WORKERS", 32), help="Number of celery server workers to fire up")