mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
Add command to refresh datasources (#2180)
This commit is contained in:
parent
527a8af060
commit
acfe62eaf7
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user