Skip to content

Commit

Permalink
Add command to refresh datasources (#2180)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkyryliuk authored Feb 15, 2017
1 parent 527a8af commit acfe62e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions superset/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit acfe62e

Please sign in to comment.