Refresh sqllab datasources cache
()
| 588 | @superset.command() |
| 589 | @with_appcontext |
| 590 | def update_datasources_cache() -> None: |
| 591 | """Refresh sqllab datasources cache""" |
| 592 | # pylint: disable=import-outside-toplevel |
| 593 | from superset.models.core import Database |
| 594 | |
| 595 | for database in db.session.query(Database).all(): |
| 596 | if database.allow_multi_schema_metadata_fetch: |
| 597 | print("Fetching {} datasources ...".format(database.name)) |
| 598 | try: |
| 599 | database.get_all_table_names_in_database( |
| 600 | force=True, cache=True, cache_timeout=24 * 60 * 60 |
| 601 | ) |
| 602 | database.get_all_view_names_in_database( |
| 603 | force=True, cache=True, cache_timeout=24 * 60 * 60 |
| 604 | ) |
| 605 | except Exception as ex: # pylint: disable=broad-except |
| 606 | print("{}".format(str(ex))) |
| 607 | |
| 608 | |
| 609 | @superset.command() |
nothing calls this directly
no test coverage detected