def get_schema(config, dag_name, schema="instance"): """ Gets a schema by name from airflow server. We use the variable api. We transform the jsonschema into a marshmallow class """ af_client = Airflow.from_config(config) if not af_client.is_alive(): raise AirflowError(error="Airflow is not accessible") schema_json = af_client.get_one_schema(dag_name, schema) manager = SchemaManager(schema_json) return manager.jsonschema_to_flask()
from cornflow_client import SchemaManager, get_pulp_jsonschema import os fileDir = os.path.dirname(__file__) manager = SchemaManager(get_pulp_jsonschema()) DataSchema = manager.jsonschema_to_flask()