MCPcopy
hub / github.com/apache/superset / refresh_druid

Function refresh_druid

superset/cli.py:249–264  ·  view source on GitHub ↗

Refresh druid datasources

(datasource: str, merge: bool)

Source from the content-addressed store, hash-verified

247 help="Specify using 'merge' property during operation. " "Default value is False.",
248)
249def refresh_druid(datasource: str, merge: bool) -> None:
250 """Refresh druid datasources"""
251 # pylint: disable=import-outside-toplevel
252 from superset.connectors.druid.models import DruidCluster
253
254 session = db.session()
255
256 for cluster in session.query(DruidCluster).all():
257 try:
258 cluster.refresh_datasources(datasource_name=datasource, merge_flag=merge)
259 except Exception as ex: # pylint: disable=broad-except
260 print("Error while processing cluster '{}'\n{}".format(cluster, str(ex)))
261 logger.exception(ex)
262 cluster.metadata_last_refreshed = datetime.now()
263 print("Refreshed metadata from cluster " "[" + cluster.cluster_name + "]")
264 session.commit()
265
266
267if feature_flags.get("VERSIONED_EXPORT"):

Callers

nothing calls this directly

Calls 3

exceptionMethod · 0.80
queryMethod · 0.45
refresh_datasourcesMethod · 0.45

Tested by

no test coverage detected