1. First, we will set up the imports that are required for the dashboard view:
from __future__ import annotations from typing import TYPE_CHECKING from airflow.auth.managers.models.resource_details import AccessView from airflow.utils.session import NEW_SESSION, provide_session from airflow.www.auth import has_access_view from flask_appbuilder import BaseView, expose from sqlalchemy import text if TYPE_CHECKING: from sqlalchemy.orm import Session
2. Let’s set up the MetricsDashboardView class to define the route for the web view:
class MetricsDashboardView(BaseView): """A Flask-AppBuilder View for a metrics dashboard""" default_view = "index" route_base = "/metrics_dashboard"
3. Finally, the index function will execute the queries we need to run against the Airflow database to provide our metrics:
标签:Airflow,Study,metrics,airflow,dashboard,import,Notes,view From: https://www.cnblogs.com/zhangzhihui/p/18681153