diff --git a/.env b/.env deleted file mode 100644 index fb72e32b5e359bccd3cc054ce3d5ed1ccdcdb9c6..0000000000000000000000000000000000000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -API_BASE=http://localhost -API_PORT=8180 -EXPORT_DIR=exports/ -UPLOAD_DIR=uploads/ -CORS_ORIGIN=http://localhost:8080 \ No newline at end of file diff --git a/.local.env b/.local.env new file mode 100644 index 0000000000000000000000000000000000000000..a2973f3c8ccfbe1364eafede774ca757dcb8f335 --- /dev/null +++ b/.local.env @@ -0,0 +1,11 @@ +API_BASE=http://localhost +API_PORT=8180 +EXPORT_DIR=exports/ +UPLOAD_DIR=uploads/ +CORS_ORIGIN=http://localhost:8080 +MITM_DATABASE_DIALECT= +MITM_DATABASE_USER= +MITM_DATABASE_PASSWORD= +MITM_DATABASE_HOST= +MITM_DATABASE_PORT= +MITM_DATABASE_DB= \ No newline at end of file diff --git a/app/db/adapters.py b/app/db/adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..8599568956a4fcf6e3d7c65b50dd93eeaa3b74a5 --- /dev/null +++ b/app/db/adapters.py @@ -0,0 +1,73 @@ +from typing import Type, Generic, TypeVar, Any + +import pydantic +import sqlalchemy as sa +from fastapi.encoders import jsonable_encoder + +T = TypeVar('T', bound=pydantic.BaseModel) + +class PydanticType(sa.types.TypeDecorator, Generic[T]): + """Pydantic type. + SAVING: + - Uses SQLAlchemy JSON type under the hood. + - Acceps the pydantic model and converts it to a dict on save. + - SQLAlchemy engine JSON-encodes the dict to a string. + RETRIEVING: + - Pulls the string from the database. + - SQLAlchemy engine JSON-decodes the string to a dict. + - Uses the dict to create a pydantic model. + """ + impl = sa.types.JSON + + pydantic_type: Type[T] + + def load_dialect_impl(self, dialect): + # Use JSONB for PostgreSQL and JSON for other databases. + if dialect.name == "postgresql": + return dialect.type_descriptor(sa.JSONB()) + else: + return dialect.type_descriptor(sa.JSON()) + + def process_bind_param(self, value, dialect) -> Any | None: + if value: + return jsonable_encoder(value) + + def process_result_value(self, value, dialect) -> T | None: + if value: + return self.pydantic_type.model_validate(value) + + @classmethod + def wrap(cls, pydantic_type: Type[T]) -> Type[sa.TypeDecorator]: + """Creates a concrete SQLAlchemy type with the given Pydantic model.""" + pt = pydantic_type + class ConcretePydanticType(cls): + pydantic_type = pt # Store the Pydantic type + + return ConcretePydanticType + + #def coerce_compared_value(self, op, value): + # return self.impl.coerce_compared_value(op, value) + +S = TypeVar('S') + +class StrType(sa.types.TypeDecorator, Generic[S]): + impl = sa.types.Text + + wrapped_type: Type[S] + + def process_bind_param(self, value, dialect) -> Any | None: + if value: + return str(value) + + def process_result_value(self, value, dialect) -> S | None: + if value: + return self.wrapped_type(value) + + @classmethod + def wrap(cls, wrapped_type: Type[S]) -> Type[sa.TypeDecorator]: + w = wrapped_type + + class ConcreteTypeAdapter(cls): + wrapped_type = w + + return ConcreteTypeAdapter \ No newline at end of file diff --git a/app/db/models.py b/app/db/models.py new file mode 100644 index 0000000000000000000000000000000000000000..9b4331a3cf27d4cba4936fc2342546b441c3047a --- /dev/null +++ b/app/db/models.py @@ -0,0 +1,42 @@ +import uuid +from uuid import UUID + +import pydantic +from mitm_tooling.representation import Header, SQLRepresentationSchema, mk_sql_rep_schema +from mitm_tooling.transformation.superset.common import SupersetDBConnectionInfo +from pydantic import AnyUrl, BaseModel +from sqlmodel import SQLModel, Field + +from app.db.adapters import PydanticType, StrType + +APPLICATION_DB_SCHEMA = 'main' # 'APPLICATION_DB' + + +class AddTrackedMitMDataset(BaseModel): + uuid: UUID | None = None + dataset_name: str + schema_name: str + sql_alchemy_uri: AnyUrl + mitm_header: Header + + +class TrackedMitMDataset(SQLModel, table=True): + model_config = pydantic.ConfigDict(arbitrary_types_allowed=True) + __tablename__ = 'uploaded_mitm_datasets' + __table_args__ = {'schema': APPLICATION_DB_SCHEMA} + + # id: int = Field(primary_key=True, sa_column_kwargs={'autoincrement': True}) + uuid: UUID = Field(primary_key=True, default_factory=uuid.uuid4) + dataset_name: str = Field() + schema_name: str = Field() + is_local: bool = Field(default=True, nullable=False) + sql_alchemy_uri: AnyUrl = Field(sa_type=StrType.wrap(AnyUrl)) + mitm_header: Header = Field(sa_type=PydanticType.wrap(Header), repr=False) + + @property + def superset_connection_info(self) -> SupersetDBConnectionInfo: + return SupersetDBConnectionInfo(sql_alchemy_uri=self.sql_alchemy_uri, schema_name=self.schema_name) + + @property + def sql_rep_schema(self) -> SQLRepresentationSchema: + return mk_sql_rep_schema(self.mitm_header, override_schema=self.schema_name) diff --git a/app/db/setup.py b/app/db/setup.py index a500f726c1d3f7043a20d4fe030341148ce0a144..3621b7ce09f846f8adca0e84dbaa48b9633c4799 100644 --- a/app/db/setup.py +++ b/app/db/setup.py @@ -2,11 +2,13 @@ import logging import sqlalchemy as sa from mitm_tooling.utilities.python_utils import pick_from_mapping -from sqlalchemy import create_engine +from sqlalchemy import create_engine, inspect +from sqlalchemy.orm import Session +from .utils import create_schema from ..config import app_cfg -logger = logging.getLogger() +logger = logging.getLogger(__name__) MITM_DATABASE_URL = sa.engine.URL.create(*pick_from_mapping(app_cfg, ['MITM_DATABASE_DIALECT', 'MITM_DATABASE_USER', 'MITM_DATABASE_PASSWORD', 'MITM_DATABASE_HOST', 'MITM_DATABASE_PORT', 'MITM_DATABASE_DB'], flatten=True)) @@ -16,7 +18,13 @@ if MITM_DATABASE_URL.get_dialect().name == 'sqlite': execution_options.update(check_same_thread=False) engine = create_engine(MITM_DATABASE_URL, execution_options=execution_options) -logger.info(f'Setting up MITM DB @ {MITM_DATABASE_URL}') -#with engine.connect() as connection: -# connection.execute(sa.text('SELECT 1')) +def init_db(): + from .models import SQLModel, APPLICATION_DB_SCHEMA + logger.info(f'Setting up MITM DB @ {MITM_DATABASE_URL}') + with Session(engine) as session: + if APPLICATION_DB_SCHEMA not in inspect(engine).get_schema_names(): + create_schema(session, APPLICATION_DB_SCHEMA) + session.commit() + SQLModel.metadata.create_all(session.connection(), checkfirst=True) + session.commit() \ No newline at end of file diff --git a/app/db/utils.py b/app/db/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..cd496d72bb6be602235e268f23c448e9a17ef8eb --- /dev/null +++ b/app/db/utils.py @@ -0,0 +1,25 @@ +from uuid import UUID + +import sqlalchemy as sa +import sqlmodel +from mitm_tooling.extraction.sql.data_models import DBMetaInfo +from mitm_tooling.extraction.sql.db import connect_and_reflect +from sqlalchemy.sql.ddl import CreateSchema + +from .models import TrackedMitMDataset + + +def infer_uploaded_mitm_dataset_schema(engine: sa.Engine, mitm_dataset_uuid: UUID) -> DBMetaInfo | None: + upload_info = None + with sqlmodel.Session(engine) as session: + upload_info = session.get(TrackedMitMDataset, (mitm_dataset_uuid,)) + if upload_info is not None: + meta, _ = connect_and_reflect(engine, allowed_schemas={upload_info.schema_name}) + return DBMetaInfo.from_sa_meta(meta, default_schema=upload_info.schema_name) + + +def create_schema(conn: sa.Connection | sa.orm.session.Session, unique_schema_name: str) -> None: + if conn.dialect.name == 'sqlite': + conn.execute(sa.text(f"ATTACH DATABASE ':memory:' AS {unique_schema_name}")) + else: + conn.execute(CreateSchema(unique_schema_name, if_not_exists=False)) diff --git a/app/dependencies/db.py b/app/dependencies/db.py index e5c551f4227cc0234bbc9b41c7775864086568ed..2c8f28f96e81d24766832be87aaed97cd6ee673f 100644 --- a/app/dependencies/db.py +++ b/app/dependencies/db.py @@ -1,5 +1,6 @@ from typing import Annotated +import sqlmodel from fastapi import Depends from sqlalchemy import engine, Engine from sqlalchemy.orm import Session @@ -16,5 +17,11 @@ def get_session(): yield session +def get_orm_session(): + with sqlmodel.Session(engine) as session: + yield session + + DBEngineDependency = Annotated[Engine, Depends(get_engine)] DBSessionDependency = Annotated[Session, Depends(get_session)] +ORMSessionDependency = Annotated[sqlmodel.Session, Depends(get_orm_session)] diff --git a/app/dependencies/orm.py b/app/dependencies/orm.py new file mode 100644 index 0000000000000000000000000000000000000000..c62d716f2de2d66e7ffc91a0600416000406e575 --- /dev/null +++ b/app/dependencies/orm.py @@ -0,0 +1,17 @@ +from typing import Annotated +from uuid import UUID + +import fastapi +from fastapi import HTTPException, Depends + +from .db import ORMSessionDependency +from ..db.models import TrackedMitMDataset + + +def get_uploaded_dataset(session: ORMSessionDependency, uuid: UUID = fastapi.Path()) -> TrackedMitMDataset: + o = session.get(TrackedMitMDataset, (uuid,)) + if o is None: + raise HTTPException(status_code=404, detail='Referenced MitM Dataset does not exist.') + return o + +TrackedMitMDatasetDependency = Annotated[TrackedMitMDataset, Depends(get_uploaded_dataset)] \ No newline at end of file diff --git a/app/dependencies/startup.py b/app/dependencies/startup.py index 135c0ea66a04ae04b106e2fe423d8fec3c048fab..90bc3690997189c839e2e3a473439c7130ad235f 100644 --- a/app/dependencies/startup.py +++ b/app/dependencies/startup.py @@ -2,13 +2,12 @@ from contextlib import asynccontextmanager from fastapi import FastAPI from fastapi.routing import APIRoute -from sqlmodel import SQLModel -from ..db.setup import engine @asynccontextmanager async def lifecycle(app): - SQLModel.metadata.create_all(bind=engine) + from ..db.setup import init_db + init_db() yield diff --git a/app/main.py b/app/main.py index c76888dfe5ce40b7f1da0e8a203e141799a2d0ec..4e9b76c585bc867a66ad1a79fa2e4a67525fb31b 100644 --- a/app/main.py +++ b/app/main.py @@ -2,12 +2,12 @@ from fastapi import FastAPI from .config import app_cfg from .dependencies.startup import lifecycle, use_route_names_as_operation_ids -from .routers import upload, definitions +from .routes import mitm_dataset, definitions app = FastAPI(title='SupersetMitMService', lifespan=lifecycle, root_path=app_cfg['API_PREFIX']) +app.include_router(mitm_dataset.router) app.include_router(definitions.router) -app.include_router(upload.router) use_route_names_as_operation_ids(app) @@ -15,3 +15,8 @@ use_route_names_as_operation_ids(app) @app.get('/') async def root(): return {'message': 'Hello World'} + + +@app.get('/health') +async def health(): + return {'status': 'healthy'} diff --git a/app/models/imported_mitm.py b/app/models/imported_mitm.py deleted file mode 100644 index 1ca0f0296312f596aead5a2452c95d2270b98d03..0000000000000000000000000000000000000000 --- a/app/models/imported_mitm.py +++ /dev/null @@ -1,13 +0,0 @@ -import sqlmodel -from mitm_tooling.definition import MITM -from mitm_tooling.transformation.superset.definitions import SupersetAssetsDef -from sqlmodel import SQLModel -import pydantic - -class ImportedMitM(SQLModel): - id: int = sqlmodel.Field(sa_column_kwargs={'autoincrement': True}, primary_key=True, nullable=False) - superset_id: int - uuid: str - mitm: MITM - asset_def: SupersetAssetsDef - superset_response: pydantic.JsonValue diff --git a/app/routers/definitions.py b/app/routers/definitions.py deleted file mode 100644 index 80b0a3b4c85c88d645d1fc2c87d00a795249be49..0000000000000000000000000000000000000000 --- a/app/routers/definitions.py +++ /dev/null @@ -1,45 +0,0 @@ -from fastapi import APIRouter -from mitm_tooling.representation import Header -from mitm_tooling.transformation.superset.definition_bundles import SupersetMitMDatasetBundle -from pydantic import AnyUrl, BaseModel - -router = APIRouter(prefix='/definitions', tags=['definitions']) - -from mitm_tooling.transformation.superset.definitions import SupersetAssetsDef -from mitm_tooling.transformation.superset.interface import mk_superset_mitm_dataset_import, \ - mk_superset_visualization_import - - -class MitMDatasetImportResponse(BaseModel): - definition_bundle: SupersetMitMDatasetBundle - base_assets: SupersetAssetsDef - - -class MitMVisualizationResponse(BaseModel): - definition_bundle: SupersetMitMDatasetBundle - base_assets: SupersetAssetsDef - - -def tentative_superset_mount_url(db_name: str = 'db') -> AnyUrl: - return AnyUrl.build(scheme='sqlite', host='', path=f'/mounted-files/{db_name}.sqlite', - query='check_same_thread=false') - - -@router.post('/mitm_dataset') -def generate_mitm_dataset_def(dataset_name: str, - header: Header) -> MitMDatasetImportResponse: - sql_alchemy_uri = tentative_superset_mount_url() - mitm_dataset_bundle = mk_superset_mitm_dataset_import(header, sql_alchemy_uri, dataset_name) - base_assets = mitm_dataset_bundle.to_assets().base_assets - return MitMDatasetImportResponse(definition_bundle=mitm_dataset_bundle, base_assets=base_assets) - - -@router.post('/mitm_viz') -def generate_mitm_viz_def(header: Header, - mitm_dataset_bundle: SupersetMitMDatasetBundle) -> MitMVisualizationResponse: - mitm_dataset = mitm_dataset_bundle.mitm_dataset - superset_visualization_bundle = mk_superset_visualization_import(header, mitm_dataset_bundle.datasource_bundle) - bundle = SupersetMitMDatasetBundle(mitm_dataset=mitm_dataset, - datasource_bundle=mitm_dataset_bundle.datasource_bundle, - visualization_bundle=superset_visualization_bundle) - return MitMVisualizationResponse(definition_bundle=bundle, base_assets=bundle.to_assets().base_assets) diff --git a/app/routers/upload.py b/app/routers/upload.py deleted file mode 100644 index 92915e421506c3f8f74f99d96750049084a291e3..0000000000000000000000000000000000000000 --- a/app/routers/upload.py +++ /dev/null @@ -1,54 +0,0 @@ -import pydantic -import sqlalchemy as sa -from fastapi import UploadFile, File -from fastapi.routing import APIRouter -from mitm_tooling.definition import MITM -from mitm_tooling.io import read_zip -from mitm_tooling.representation import mk_sql_rep_schema, insert_mitm_data -from mitm_tooling.transformation.superset.common import SupersetDBConnectionInfo -from mitm_tooling.utilities.sql_utils import sa_url_into_any_url - -from app.dependencies.db import DBEngineDependency - -router = APIRouter(prefix='/upload', tags=['upload']) - - -class UploadMitMResponse(pydantic.BaseModel): - status: str - db_conn_info: SupersetDBConnectionInfo - - -@router.post('/mitm_dataset') -def upload_mitm_dataset( - engine: DBEngineDependency, - dataset_identifier: str, - mitm: MITM = MITM.MAED, - mitm_zip: UploadFile = File(media_type='application/zip')): - mitm_data = read_zip(mitm_zip.file, mitm) - unique_schema_name = dataset_identifier - - sql_rep_schema = mk_sql_rep_schema(mitm_data.header, override_schema=unique_schema_name) - - # engine.execute(CreateSchema(unique_schema_name, if_not_exists=False)) - - with engine.connect() as connection: - connection.execute(sa.text(f"attach ':memory:' as {unique_schema_name}")) - insert_mitm_data(connection, sql_rep_schema, mitm_data) - connection.commit() - - sql_alchemy_uri = sa_url_into_any_url(engine.url) - db_conn_info = SupersetDBConnectionInfo(sql_alchemy_uri=sql_alchemy_uri, schema_name=unique_schema_name) - - return UploadMitMResponse(status='success', db_conn_info=db_conn_info) - - -class UploadedMitMDatasetsResponse(pydantic.BaseModel): - identifiers: list[str] - - -@router.get('/mitm_datasets') -def get_mitm_datasets( - engine: DBEngineDependency): - inspector = sa.inspect(engine) - schema_names = inspector.get_schema_names() - return UploadedMitMDatasetsResponse(identifiers=schema_names) diff --git a/app/routes/__init__.py b/app/routes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/routes/definitions/__init__.py b/app/routes/definitions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e5d16142a14b01bab0804a708b527a6192bf4b8a --- /dev/null +++ b/app/routes/definitions/__init__.py @@ -0,0 +1 @@ +from .router import router \ No newline at end of file diff --git a/app/routes/definitions/requests.py b/app/routes/definitions/requests.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/routes/definitions/responses.py b/app/routes/definitions/responses.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/routes/definitions/router.py b/app/routes/definitions/router.py new file mode 100644 index 0000000000000000000000000000000000000000..b169db7f0a6d8611cc0253e2a01d06cd056d95a2 --- /dev/null +++ b/app/routes/definitions/router.py @@ -0,0 +1,79 @@ +import io +import logging + +from fastapi import APIRouter +from mitm_tooling.representation import Header +from mitm_tooling.transformation.superset import write_superset_import_as_zip +from mitm_tooling.transformation.superset.common import SupersetDBConnectionInfo +from mitm_tooling.transformation.superset.definition_bundles import SupersetMitMDatasetBundle +from starlette.responses import StreamingResponse + +from app.dependencies.orm import TrackedMitMDatasetDependency + +router = APIRouter(prefix='/definitions', tags=['definitions']) +logger = logging.getLogger(__name__) + +from mitm_tooling.transformation.superset.definitions import SupersetMitMDatasetImport +from mitm_tooling.transformation.superset.interface import mk_superset_mitm_dataset_bundle, \ + mk_superset_visualization_bundle + + +@router.post('/mitm_dataset') +def generate_mitm_dataset_bundle(dataset_name: str, + mitm_header: Header, + db_conn_info: SupersetDBConnectionInfo, + include_visualizations: bool = False) -> SupersetMitMDatasetBundle: + mitm_dataset_bundle = mk_superset_mitm_dataset_bundle(dataset_name, mitm_header, db_conn_info) + if include_visualizations: + mitm_dataset_bundle.visualization_bundle = mk_superset_visualization_bundle(mitm_header, + mitm_dataset_bundle.datasource_bundle) + return mitm_dataset_bundle + + +@router.post('/mitm_dataset/import') +def generate_mitm_dataset_import(dataset_name: str, + mitm_header: Header, + db_conn_info: SupersetDBConnectionInfo, + include_visualizations: bool = False) -> SupersetMitMDatasetImport: + return generate_mitm_dataset_bundle(dataset_name, mitm_header, db_conn_info, include_visualizations).to_import() + + +@router.post('/mitm_dataset/import/zip', response_class=StreamingResponse, + responses={200: {'content': {'application/zip': {}}}}) +def generate_mitm_dataset_import_zip(dataset_name: str, + mitm_header: Header, + db_conn_info: SupersetDBConnectionInfo, + include_visualizations: bool = False) -> StreamingResponse: + assets = generate_mitm_dataset_bundle(dataset_name, mitm_header, db_conn_info, include_visualizations) + bio = io.BytesIO() + write_superset_import_as_zip(bio, assets) + bio.seek(0) + return StreamingResponse(bio, media_type='application/zip') + + +@router.get('/mitm_dataset/{uuid}/') +def generate_uploaded_mitm_dataset_bundle(uploaded_dataset: TrackedMitMDatasetDependency, + include_visualizations: bool = False) -> SupersetMitMDatasetBundle: + return generate_mitm_dataset_bundle(uploaded_dataset.dataset_name, uploaded_dataset.mitm_header, + uploaded_dataset.superset_connection_info, + include_visualizations=include_visualizations) + + +@router.get('/mitm_dataset/{uuid}/import') +def generate_uploaded_mitm_dataset_import(uploaded_dataset: TrackedMitMDatasetDependency, + include_visualizations: bool = False) -> SupersetMitMDatasetImport: + mitm_dataset_bundle = generate_uploaded_mitm_dataset_bundle(uploaded_dataset, + include_visualizations=include_visualizations) + return mitm_dataset_bundle.to_import() + + +@router.get('/mitm_dataset/{uuid}/import/zip', response_class=StreamingResponse, + responses={200: {'content': {'application/zip': {}}}}) +def generate_uploaded_mitm_dataset_import_zip(uploaded_dataset: TrackedMitMDatasetDependency, + include_visualizations: bool = False) -> StreamingResponse: + assets = generate_uploaded_mitm_dataset_import(uploaded_dataset, + include_visualizations=include_visualizations) + bio = io.BytesIO() + write_superset_import_as_zip(bio, assets) + bio.seek(0) + return StreamingResponse(bio, media_type='application/zip') diff --git a/app/routes/mitm_dataset/__init__.py b/app/routes/mitm_dataset/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e5d16142a14b01bab0804a708b527a6192bf4b8a --- /dev/null +++ b/app/routes/mitm_dataset/__init__.py @@ -0,0 +1 @@ +from .router import router \ No newline at end of file diff --git a/app/routes/mitm_dataset/register_external.py b/app/routes/mitm_dataset/register_external.py new file mode 100644 index 0000000000000000000000000000000000000000..2d52f82f8c3b2bbff5abcaf6a6edca29a3cc8af0 --- /dev/null +++ b/app/routes/mitm_dataset/register_external.py @@ -0,0 +1,42 @@ +import sqlalchemy as sa +from mitm_tooling.extraction.sql.data_models import VirtualDB, DBMetaInfo, SourceDBType, VirtualView +from mitm_tooling.extraction.sql.db import connect_and_reflect +from mitm_tooling.representation import Header, mk_sql_rep_schema +from mitm_tooling.representation.sql_representation import mk_concept_table_name +from mitm_tooling.utilities.sql_utils import create_sa_engine +from sqlalchemy.orm import Session + +from app.dependencies.db import ORMSessionDependency +from app.routes.mitm_dataset.requests import RegisterExternalMitMDatasetRequest +from app.routes.mitm_dataset.responses import RegisterMitMResponse + + +def register_mitm_dataset( + session: ORMSessionDependency, + request: RegisterExternalMitMDatasetRequest, +) -> RegisterMitMResponse: + vdb = VirtualDB() + for cvv in request.cvvs: + vdb.put_view(cvv.to_virtual_view(vdb.sa_meta)) + + virtual_db_meta = vdb.to_db_meta_info() + remote_engine = create_sa_engine(request.sql_alchemy_uri) + sa_meta, _ = connect_and_reflect(remote_engine) + original_db_meta = DBMetaInfo.from_sa_meta(sa_meta, 'main') + db_metas = {SourceDBType.OriginalDB: original_db_meta, SourceDBType.VirtualDB: virtual_db_meta} + header_entries = [] + mapped_vvs = [] + result_meta = sa.MetaData() + with Session(remote_engine) as session: + for mapping in request.mappings: + hep, from_clause = mapping.apply(db_metas) + header_entries.extend(hep.from_session(session)) + concept_table_name = mk_concept_table_name(mapping.mitm, mapping.concept) + mapped_vvs.append(VirtualView.from_from_clause(concept_table_name, from_clause, result_meta)) + + header = Header(mitm=request.mitm, header_entries=header_entries) + sql_rep_schema = mk_sql_rep_schema(header, view_generators=None) + + # TODO connect mapped_vvs to sql_rep_schema + + raise NotImplementedError() diff --git a/app/routes/mitm_dataset/requests.py b/app/routes/mitm_dataset/requests.py new file mode 100644 index 0000000000000000000000000000000000000000..af866de0ed1db45acba7c44163fea275c061770d --- /dev/null +++ b/app/routes/mitm_dataset/requests.py @@ -0,0 +1,19 @@ +import pydantic +from mitm_tooling.definition import MITM +from mitm_tooling.extraction.sql.data_models import CompiledVirtualView +from mitm_tooling.extraction.sql.mapping import ConceptMapping +from pydantic import AnyUrl + +from app.db.models import AddTrackedMitMDataset + + +class AddTrackedMitMDatasetRequest(AddTrackedMitMDataset): + pass + + +class RegisterExternalMitMDatasetRequest(pydantic.BaseModel): + dataset_name: str + sql_alchemy_uri: AnyUrl + mitm: MITM + cvvs: list[CompiledVirtualView] + mappings: list[ConceptMapping] diff --git a/app/routes/mitm_dataset/responses.py b/app/routes/mitm_dataset/responses.py new file mode 100644 index 0000000000000000000000000000000000000000..1d36eee007425674d56d246f96b9119330d5dcf4 --- /dev/null +++ b/app/routes/mitm_dataset/responses.py @@ -0,0 +1,19 @@ +from typing import Literal + +import pydantic + +from app.db.models import TrackedMitMDataset + + +class TrackMitMResponse(pydantic.BaseModel): + status: Literal['success', 'failure'] + tracked_mitm_dataset: TrackedMitMDataset | None = None + msg: str | None = None + + +class UploadMitMResponse(TrackMitMResponse): + pass + + +class RegisterMitMResponse(TrackMitMResponse): + pass diff --git a/app/routes/mitm_dataset/router.py b/app/routes/mitm_dataset/router.py new file mode 100644 index 0000000000000000000000000000000000000000..51438a523ab5e29bc0233b5538a49ab7689d4d18 --- /dev/null +++ b/app/routes/mitm_dataset/router.py @@ -0,0 +1,81 @@ +import logging +from typing import Sequence + +import sqlmodel +from fastapi import UploadFile, File, HTTPException +from fastapi.routing import APIRouter +from mitm_tooling.definition import MITM +from mitm_tooling.io import read_zip +from mitm_tooling.representation import mk_sql_rep_schema, insert_mitm_data +from mitm_tooling.transformation.superset.common import name_plus_uuid +from mitm_tooling.transformation.superset.factories.utils import mk_uuid +from mitm_tooling.utilities.sql_utils import sa_url_into_any_url + +from app.db.models import TrackedMitMDataset +from app.db.utils import create_schema +from app.dependencies.db import DBEngineDependency, ORMSessionDependency +from app.dependencies.orm import TrackedMitMDatasetDependency +from app.routes.mitm_dataset.requests import AddTrackedMitMDatasetRequest, RegisterExternalMitMDatasetRequest +from app.routes.mitm_dataset.responses import UploadMitMResponse, RegisterMitMResponse + +router = APIRouter(prefix='/mitm_dataset', tags=['mitm_dataset']) +logger = logging.getLogger(__name__) + + +@router.post('/upload') +def upload_mitm_dataset( + engine: DBEngineDependency, + dataset_name: str, + mitm: MITM = MITM.MAED, + mitm_zip: UploadFile = File(media_type='application/zip')) -> UploadMitMResponse: + mitm_data = read_zip(mitm_zip.file, mitm) + + uuid = mk_uuid() + unique_schema_name = name_plus_uuid(dataset_name, uuid, sep='_') + + sql_rep_schema = mk_sql_rep_schema(mitm_data.header, override_schema=unique_schema_name, view_generators=None) + + try: + with engine.connect() as connection: + create_schema(connection, unique_schema_name) + insert_mitm_data(connection, sql_rep_schema, mitm_data) + connection.commit() + + model = TrackedMitMDataset(uuid=uuid, dataset_name=dataset_name, schema_name=unique_schema_name, + sql_alchemy_uri=sa_url_into_any_url(engine.url), mitm_header=mitm_data.header) + with sqlmodel.Session(engine) as session: + session.add(model) + session.commit() + session.refresh(model) + + return UploadMitMResponse(status='success', tracked_mitm_dataset=model) + except Exception as e: + logger.error(e) + raise HTTPException(500, str(e)) + # return UploadMitMResponse(status='failure', msg=str(e)) + +@router.post('/register') +def register_mitm_dataset(session: ORMSessionDependency, request: RegisterExternalMitMDatasetRequest) -> RegisterMitMResponse: + from .register_external import register_mitm_dataset + return register_mitm_dataset(session, request) + +@router.post('/') +def post_mitm_dataset(session: ORMSessionDependency, new_mitm_dataset: AddTrackedMitMDatasetRequest) -> None: + new = TrackedMitMDataset.model_validate(**new_mitm_dataset.model_dump()) + session.add(new) + + +@router.get('/{uuid}') +def get_mitm_dataset(uploaded_dataset: TrackedMitMDatasetDependency) -> TrackedMitMDataset: + return uploaded_dataset + + +@router.get('/', response_model=list[TrackedMitMDataset]) +def get_mitm_datasets(session: ORMSessionDependency) -> Sequence[TrackedMitMDataset]: + sequence = session.exec(sqlmodel.select(TrackedMitMDataset)).all() + return sequence + + +@router.delete('/{uuid}') +def delete_mitm_dataset(session: ORMSessionDependency, uploaded_dataset: TrackedMitMDatasetDependency) -> None: + session.delete(uploaded_dataset) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1cc1957bf019eb4eacf2a2ea2988270f772afc2e..42c555e9164800762ee71a44e8d3f8d786ad54ad 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,10 +2,28 @@ services: mitm-service: build: context: . + container_name: test_mitm_service volumes: - ./exports:/exports - ./uploads:/uploads ports: - "8180:8180" - env_file: .env + env_file: docker/.env + depends_on: + mitm-db: + condition: service_started # command: ["fastapi", "run", "app/main.py", "--port", "8180"] + + mitm-db: + image: timescale/timescaledb:latest-pg16 + container_name: test_mitm_db + restart: unless-stopped + ports: + - 5432:5432 + env_file: docker/.env + volumes: + - mitm_db_home:/var/lib/postgresql/data + +volumes: + mitm_db_home: + external: False \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c01cf575f0c1c0b3eb313539f0f22b278558aba4..6d397174cf0283c96b213b52a225eafd04c6afe1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,12 +15,13 @@ pydantic = "*" fastapi = { version = "^0.115.8", extras = ["standard"] } uvicorn = "^0.34.0" python-multipart = "*" +psycopg2 = "*" sqlalchemy = "^2.0.38" -sqlmodel = "^0.0.22" +sqlmodel = "^0.0.24" mitm-tooling = { version = "*" } -#mitm-tooling = { version = "*", source = "local", develop = true } +# mitm-tooling = { version = "*", source = "local", develop = true } -[tool.poetry.dev.dependencies] +[tool.poetry.group.dev.dependencies] datamodel-code-generator = "*" [[tool.poetry.source]] diff --git a/schema/openapi.json b/schema/openapi.json index 0b1bec5e570f8d8b2851b984ec7a22de704a754b..ce6eddd8e10dd6d4963b3fd50833be84214badd7 100644 --- a/schema/openapi.json +++ b/schema/openapi.json @@ -1 +1 @@ -{"openapi": "3.1.0", "info": {"title": "SupersetMitMService", "version": "0.1.0"}, "paths": {"/definitions/mitm_dataset": {"post": {"tags": ["definitions"], "summary": "Generate Mitm Dataset Def", "operationId": "generate_mitm_dataset_def", "parameters": [{"name": "dataset_name", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Name"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Header"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MitMDatasetImportResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_viz": {"post": {"tags": ["definitions"], "summary": "Generate Mitm Viz Def", "operationId": "generate_mitm_viz_def", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_generate_mitm_viz_def_definitions_mitm_viz_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MitMVisualizationResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/upload/mitm_dataset": {"post": {"tags": ["upload"], "summary": "Upload Mitm Dataset", "operationId": "upload_mitm_dataset", "parameters": [{"name": "dataset_identifier", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Identifier"}}, {"name": "mitm", "in": "query", "required": false, "schema": {"$ref": "#/components/schemas/MITM", "default": "MAED"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_mitm_dataset_upload_mitm_dataset_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/upload/mitm_datasets": {"get": {"tags": ["upload"], "summary": "Get Mitm Datasets", "operationId": "get_mitm_datasets", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/": {"get": {"summary": "Root", "operationId": "root__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}}, "components": {"schemas": {"AnnotationLayer": {"properties": {"name": {"type": "string", "title": "Name"}, "value": {"type": "integer", "title": "Value"}, "annotationType": {"$ref": "#/components/schemas/AnnotationType"}, "sourceType": {"$ref": "#/components/schemas/AnnotationSource", "default": "table"}, "opacity": {"type": "string", "title": "Opacity", "default": ""}, "overrides": {"$ref": "#/components/schemas/AnnotationOverrides"}, "hideLine": {"type": "boolean", "title": "Hideline", "default": false}, "show": {"type": "boolean", "title": "Show", "default": false}, "showLabel": {"type": "boolean", "title": "Showlabel", "default": false}, "showMarkers": {"type": "boolean", "title": "Showmarkers", "default": false}, "style": {"type": "string", "title": "Style", "default": "solid"}, "width": {"type": "integer", "title": "Width", "default": 1}}, "type": "object", "required": ["name", "value", "annotationType", "overrides"], "title": "AnnotationLayer"}, "AnnotationOverrides": {"properties": {"time_range": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Range"}}, "type": "object", "title": "AnnotationOverrides"}, "AnnotationSource": {"type": "string", "enum": ["line", "NATIVE", "table", ""], "title": "AnnotationSource"}, "AnnotationType": {"type": "string", "enum": ["EVENT", "FORMULA", "INTERVAL", "TIME_SERIES"], "title": "AnnotationType"}, "Body_generate_mitm_viz_def_definitions_mitm_viz_post": {"properties": {"header": {"$ref": "#/components/schemas/Header"}, "mitm_dataset_bundle": {"$ref": "#/components/schemas/SupersetMitMDatasetBundle-Input"}}, "type": "object", "required": ["header", "mitm_dataset_bundle"], "title": "Body_generate_mitm_viz_def_definitions_mitm_viz_post"}, "Body_upload_mitm_dataset_upload_mitm_dataset_post": {"properties": {"mitm_zip": {"type": "string", "format": "binary", "title": "Mitm Zip"}}, "type": "object", "required": ["mitm_zip"], "title": "Body_upload_mitm_dataset_upload_mitm_dataset_post"}, "ChartDataResultFormat": {"type": "string", "enum": ["csv", "json", "xlsx"], "title": "ChartDataResultFormat"}, "ChartDataResultType": {"type": "string", "enum": ["columns", "full", "query", "results", "samples", "timegrains", "post_processed", "drill_detail"], "title": "ChartDataResultType"}, "ChartParams-Input": {"properties": {"datasource": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/DatasourceIdentifier-Input"}], "title": "Datasource"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "groupby": {"items": {"type": "string"}, "type": "array", "title": "Groupby"}, "adhoc_filters": {"items": {"$ref": "#/components/schemas/SupersetAdhocFilter"}, "type": "array", "title": "Adhoc Filters"}, "row_limit": {"type": "integer", "title": "Row Limit", "default": 10000}, "sort_by_metric": {"type": "boolean", "title": "Sort By Metric", "default": true}, "color_scheme": {"type": "string", "enum": ["blueToGreen", "supersetColors"], "title": "Color Scheme", "default": "supersetColors"}, "show_legend": {"type": "boolean", "title": "Show Legend", "default": true}, "legendType": {"type": "string", "title": "Legendtype", "default": "scroll"}, "legendOrientation": {"type": "string", "title": "Legendorientation", "default": "top"}, "extra_form_data": {"type": "object", "title": "Extra Form Data"}, "slice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Slice Id"}, "dashboards": {"items": {"type": "integer"}, "type": "array", "title": "Dashboards"}}, "type": "object", "required": ["datasource", "viz_type"], "title": "ChartParams"}, "ChartParams-Output": {"properties": {"datasource": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/DatasourceIdentifier-Output"}], "title": "Datasource"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "groupby": {"items": {"type": "string"}, "type": "array", "title": "Groupby"}, "adhoc_filters": {"items": {"$ref": "#/components/schemas/SupersetAdhocFilter"}, "type": "array", "title": "Adhoc Filters"}, "row_limit": {"type": "integer", "title": "Row Limit", "default": 10000}, "sort_by_metric": {"type": "boolean", "title": "Sort By Metric", "default": true}, "color_scheme": {"type": "string", "enum": ["blueToGreen", "supersetColors"], "title": "Color Scheme", "default": "supersetColors"}, "show_legend": {"type": "boolean", "title": "Show Legend", "default": true}, "legendType": {"type": "string", "title": "Legendtype", "default": "scroll"}, "legendOrientation": {"type": "string", "title": "Legendorientation", "default": "top"}, "extra_form_data": {"type": "object", "title": "Extra Form Data"}, "slice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Slice Id"}, "dashboards": {"items": {"type": "integer"}, "type": "array", "title": "Dashboards"}}, "type": "object", "required": ["datasource", "viz_type"], "title": "ChartParams"}, "DatasourceIdentifier-Input": {"properties": {"id": {"type": "integer", "title": "Id", "default": "placeholder"}, "type": {"type": "string", "enum": ["table", "annotation"], "title": "Type", "default": "table"}, "dataset_uuid": {"type": "string", "format": "uuid", "title": "Dataset Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}}, "type": "object", "required": ["dataset_uuid"], "title": "DatasourceIdentifier"}, "DatasourceIdentifier-Output": {"properties": {"id": {"type": "integer", "title": "Id", "default": "placeholder"}, "type": {"type": "string", "enum": ["table", "annotation"], "title": "Type", "default": "table"}}, "type": "object", "title": "DatasourceIdentifier"}, "ExpressionType": {"type": "string", "enum": ["SIMPLE", "SQL"], "title": "ExpressionType"}, "FilterOperator": {"type": "string", "enum": ["==", "!=", ">", "<", ">=", "<=", "LIKE", "NOT LIKE", "ILIKE", "IS NULL", "IS NOT NULL", "IN", "NOT IN", "IS TRUE", "IS FALSE", "TEMPORAL_RANGE"], "title": "FilterOperator"}, "FilterStringOperators": {"type": "string", "enum": ["EQUALS", "NOT_EQUALS", "LESS_THAN", "GREATER_THAN", "LESS_THAN_OR_EQUAL", "GREATER_THAN_OR_EQUAL", "IN", "NOT_IN", "ILIKE", "LIKE", "IS_NOT_NULL", "IS_NULL", "LATEST_PARTITION", "IS_TRUE", "IS_FALSE"], "title": "FilterStringOperators"}, "FormData": {"properties": {}, "type": "object", "title": "FormData"}, "GenericDataType": {"type": "integer", "enum": [0, 1, 2, 3], "title": "GenericDataType"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Header": {"properties": {"mitm": {"$ref": "#/components/schemas/MITM"}, "header_entries": {"items": {"$ref": "#/components/schemas/HeaderEntry"}, "type": "array", "title": "Header Entries"}}, "type": "object", "required": ["mitm"], "title": "Header"}, "HeaderEntry": {"properties": {"concept": {"type": "string", "title": "Concept"}, "kind": {"type": "string", "title": "Kind"}, "type_name": {"type": "string", "title": "Type Name"}, "attributes": {"items": {"type": "string"}, "type": "array", "title": "Attributes"}, "attribute_dtypes": {"items": {"$ref": "#/components/schemas/MITMDataType"}, "type": "array", "title": "Attribute Dtypes"}}, "type": "object", "required": ["concept", "kind", "type_name", "attributes", "attribute_dtypes"], "title": "HeaderEntry"}, "MITM": {"type": "string", "enum": ["MAED", "OCEL2"], "title": "MITM"}, "MITMDataType": {"type": "string", "enum": ["text", "json", "integer", "numeric", "boolean", "datetime", "unknown", "infer"], "title": "MITMDataType"}, "MetadataType": {"type": "string", "enum": ["Database", "SqlaTable", "Slice", "Chart", "Dashboard", "Asset", "MitMDataset"], "title": "MetadataType"}, "MitMDatasetImportResponse": {"properties": {"definition_bundle": {"$ref": "#/components/schemas/SupersetMitMDatasetBundle-Output"}, "base_assets": {"$ref": "#/components/schemas/SupersetAssetsDef"}}, "type": "object", "required": ["definition_bundle", "base_assets"], "title": "MitMDatasetImportResponse"}, "MitMVisualizationResponse": {"properties": {"definition_bundle": {"$ref": "#/components/schemas/SupersetMitMDatasetBundle-Output"}, "base_assets": {"$ref": "#/components/schemas/SupersetAssetsDef"}}, "type": "object", "required": ["definition_bundle", "base_assets"], "title": "MitMVisualizationResponse"}, "QueryContext-Input": {"properties": {"datasource": {"$ref": "#/components/schemas/DatasourceIdentifier-Input"}, "queries": {"items": {"$ref": "#/components/schemas/QueryObject-Input"}, "type": "array", "title": "Queries"}, "form_data": {"anyOf": [{"$ref": "#/components/schemas/FormData"}, {"type": "object"}, {"type": "null"}], "title": "Form Data"}, "result_type": {"$ref": "#/components/schemas/ChartDataResultType", "default": "full"}, "result_format": {"$ref": "#/components/schemas/ChartDataResultFormat", "default": "json"}, "force": {"type": "boolean", "title": "Force", "default": false}, "custom_cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Custom Cache Timeout"}}, "type": "object", "required": ["datasource"], "title": "QueryContext"}, "QueryContext-Output": {"properties": {"datasource": {"$ref": "#/components/schemas/DatasourceIdentifier-Output"}, "queries": {"items": {"$ref": "#/components/schemas/QueryObject-Output"}, "type": "array", "title": "Queries"}, "form_data": {"anyOf": [{"$ref": "#/components/schemas/FormData"}, {"type": "object"}, {"type": "null"}], "title": "Form Data"}, "result_type": {"$ref": "#/components/schemas/ChartDataResultType", "default": "full"}, "result_format": {"$ref": "#/components/schemas/ChartDataResultFormat", "default": "json"}, "force": {"type": "boolean", "title": "Force", "default": false}, "custom_cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Custom Cache Timeout"}}, "type": "object", "required": ["datasource"], "title": "QueryContext"}, "QueryObject-Input": {"properties": {"annotation_layers": {"items": {"$ref": "#/components/schemas/AnnotationLayer"}, "type": "array", "title": "Annotation Layers"}, "applied_time_extras": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Applied Time Extras"}, "columns": {"items": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/SupersetAdhocColumn"}]}, "type": "array", "title": "Columns"}, "datasource": {"anyOf": [{"$ref": "#/components/schemas/DatasourceIdentifier-Input"}, {"type": "null"}]}, "extras": {"$ref": "#/components/schemas/QueryObjectExtras"}, "filters": {"items": {"$ref": "#/components/schemas/QueryObjectFilterClause"}, "type": "array", "title": "Filters"}, "metrics": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetAdhocMetric-Input"}, "type": "array"}, {"type": "null"}], "title": "Metrics"}, "granularity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Granularity"}, "from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "From Dttm"}, "to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "To Dttm"}, "inner_from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner From Dttm"}, "inner_to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner To Dttm"}, "is_rowcount": {"type": "boolean", "title": "Is Rowcount", "default": false}, "is_timeseries": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Timeseries"}, "order_desc": {"type": "boolean", "title": "Order Desc", "default": true}, "orderby": {"items": {"prefixItems": [{"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric-Input"}, {"type": "string"}]}, {"type": "boolean"}], "type": "array", "maxItems": 2, "minItems": 2}, "type": "array", "title": "Orderby"}, "post_processing": {"items": {"anyOf": [{"$ref": "#/components/schemas/SupersetPostProcessing-Input"}, {"type": "object"}]}, "type": "array", "title": "Post Processing"}, "result_type": {"anyOf": [{"$ref": "#/components/schemas/ChartDataResultType"}, {"type": "null"}]}, "row_limit": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Limit"}, "row_offset": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Offset"}, "series_columns": {"items": {"type": "string"}, "type": "array", "title": "Series Columns"}, "series_limit": {"type": "integer", "title": "Series Limit", "default": 0}, "series_limit_metric": {"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric-Input"}, {"type": "null"}]}, "time_offsets": {"items": {"type": "string"}, "type": "array", "title": "Time Offsets"}, "time_shift": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Shift"}, "time_range": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Range"}, "url_params": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Url Params"}}, "type": "object", "title": "QueryObject"}, "QueryObject-Output": {"properties": {"annotation_layers": {"items": {"$ref": "#/components/schemas/AnnotationLayer"}, "type": "array", "title": "Annotation Layers"}, "applied_time_extras": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Applied Time Extras"}, "columns": {"items": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/SupersetAdhocColumn"}]}, "type": "array", "title": "Columns"}, "datasource": {"anyOf": [{"$ref": "#/components/schemas/DatasourceIdentifier-Output"}, {"type": "null"}]}, "extras": {"$ref": "#/components/schemas/QueryObjectExtras"}, "filters": {"items": {"$ref": "#/components/schemas/QueryObjectFilterClause"}, "type": "array", "title": "Filters"}, "metrics": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetAdhocMetric-Output"}, "type": "array"}, {"type": "null"}], "title": "Metrics"}, "granularity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Granularity"}, "from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "From Dttm"}, "to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "To Dttm"}, "inner_from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner From Dttm"}, "inner_to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner To Dttm"}, "is_rowcount": {"type": "boolean", "title": "Is Rowcount", "default": false}, "is_timeseries": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Timeseries"}, "order_desc": {"type": "boolean", "title": "Order Desc", "default": true}, "orderby": {"items": {"prefixItems": [{"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric-Output"}, {"type": "string"}]}, {"type": "boolean"}], "type": "array", "maxItems": 2, "minItems": 2}, "type": "array", "title": "Orderby"}, "post_processing": {"items": {"anyOf": [{"$ref": "#/components/schemas/SupersetPostProcessing-Output"}, {"type": "object"}]}, "type": "array", "title": "Post Processing"}, "result_type": {"anyOf": [{"$ref": "#/components/schemas/ChartDataResultType"}, {"type": "null"}]}, "row_limit": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Limit"}, "row_offset": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Offset"}, "series_columns": {"items": {"type": "string"}, "type": "array", "title": "Series Columns"}, "series_limit": {"type": "integer", "title": "Series Limit", "default": 0}, "series_limit_metric": {"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric-Output"}, {"type": "null"}]}, "time_offsets": {"items": {"type": "string"}, "type": "array", "title": "Time Offsets"}, "time_shift": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Shift"}, "time_range": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Range"}, "url_params": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Url Params"}}, "type": "object", "title": "QueryObject"}, "QueryObjectExtras": {"properties": {"having": {"type": "string", "title": "Having", "default": ""}, "where": {"type": "string", "title": "Where", "default": ""}, "time_grain_sqla": {"anyOf": [{"$ref": "#/components/schemas/TimeGrain"}, {"type": "null"}]}}, "type": "object", "title": "QueryObjectExtras"}, "QueryObjectFilterClause": {"properties": {"col": {"type": "string", "title": "Col"}, "op": {"$ref": "#/components/schemas/FilterOperator"}, "val": {"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}, {"items": {"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}]}, "type": "array"}, {"prefixItems": [{"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}]}], "type": "array", "maxItems": 1, "minItems": 1}, {"type": "null"}], "title": "Val"}, "grain": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Grain"}, "isExtra": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Isextra"}}, "type": "object", "required": ["col", "op"], "title": "QueryObjectFilterClause"}, "SupersetAdhocColumn": {"properties": {"label": {"type": "string", "title": "Label"}, "sqlExpression": {"type": "string", "title": "Sqlexpression"}, "columnType": {"type": "string", "title": "Columntype", "default": "BASE_AXIS"}, "expressionType": {"type": "string", "title": "Expressiontype", "default": "SQL"}, "timeGrain": {"anyOf": [{"$ref": "#/components/schemas/TimeGrain"}, {"type": "null"}]}}, "type": "object", "required": ["label", "sqlExpression"], "title": "SupersetAdhocColumn"}, "SupersetAdhocFilter": {"properties": {"clause": {"type": "string", "title": "Clause", "default": "WHERE"}, "subject": {"type": "string", "title": "Subject"}, "operator": {"$ref": "#/components/schemas/FilterOperator"}, "operatorId": {"anyOf": [{"$ref": "#/components/schemas/FilterStringOperators"}, {"type": "null"}]}, "comparator": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Comparator", "default": "No filter"}, "expressionType": {"$ref": "#/components/schemas/ExpressionType", "default": "SIMPLE"}, "isExtra": {"type": "boolean", "title": "Isextra", "default": false}, "isNew": {"type": "boolean", "title": "Isnew", "default": false}, "sqlExpression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sqlexpression"}}, "type": "object", "required": ["subject", "operator"], "title": "SupersetAdhocFilter"}, "SupersetAdhocMetric-Input": {"properties": {"label": {"type": "string", "title": "Label"}, "column": {"$ref": "#/components/schemas/SupersetColumn"}, "expressionType": {"$ref": "#/components/schemas/ExpressionType", "default": "SIMPLE"}, "aggregate": {"$ref": "#/components/schemas/SupersetAggregate", "default": "COUNT"}, "sqlExpression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sqlexpression"}, "datasourceWarning": {"type": "boolean", "title": "Datasourcewarning", "default": false}, "hasCustomLabel": {"type": "boolean", "title": "Hascustomlabel", "default": false}, "optionName": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Optionname"}}, "type": "object", "required": ["label", "column"], "title": "SupersetAdhocMetric"}, "SupersetAdhocMetric-Output": {"properties": {"label": {"type": "string", "title": "Label"}, "column": {"$ref": "#/components/schemas/SupersetColumn"}, "expressionType": {"$ref": "#/components/schemas/ExpressionType", "default": "SIMPLE"}, "aggregate": {"$ref": "#/components/schemas/SupersetAggregate", "default": "COUNT"}, "sqlExpression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sqlexpression"}, "datasourceWarning": {"type": "boolean", "title": "Datasourcewarning", "default": false}, "hasCustomLabel": {"type": "boolean", "title": "Hascustomlabel", "default": false}, "optionName": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Optionname"}}, "type": "object", "required": ["label", "column"], "title": "SupersetAdhocMetric"}, "SupersetAggregate": {"type": "string", "enum": ["COUNT", "SUM", "MIN", "MAX", "AVG"], "title": "SupersetAggregate"}, "SupersetAssetsDef": {"properties": {"databases": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDatabaseDef"}, "type": "array"}, {"type": "null"}], "title": "Databases"}, "datasets": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDatasetDef-Output"}, "type": "array"}, {"type": "null"}], "title": "Datasets"}, "charts": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetChartDef-Output"}, "type": "array"}, {"type": "null"}], "title": "Charts"}, "dashboards": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDashboardDef"}, "type": "array"}, {"type": "null"}], "title": "Dashboards"}, "metadata": {"$ref": "#/components/schemas/SupersetMetadataDef"}}, "type": "object", "title": "SupersetAssetsDef"}, "SupersetChartDef-Input": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "slice_name": {"type": "string", "title": "Slice Name"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "dataset_uuid": {"type": "string", "format": "uuid", "title": "Dataset Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "certified_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certified By"}, "certification_details": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certification Details"}, "params": {"anyOf": [{"$ref": "#/components/schemas/ChartParams-Input"}, {"type": "object"}], "title": "Params"}, "query_context": {"anyOf": [{"type": "string", "contentMediaType": "application/json", "contentSchema": {}}, {"$ref": "#/components/schemas/QueryContext-Input"}, {"type": "null"}], "title": "Query Context"}, "cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Cache Timeout"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "is_managed_externally": {"type": "boolean", "title": "Is Managed Externally", "default": false}, "external_url": {"anyOf": [{"type": "string", "minLength": 1, "format": "uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "External Url"}}, "type": "object", "required": ["uuid", "slice_name", "viz_type", "dataset_uuid"], "title": "SupersetChartDef"}, "SupersetChartDef-Output": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "slice_name": {"type": "string", "title": "Slice Name"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "dataset_uuid": {"type": "string", "format": "uuid", "title": "Dataset Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "certified_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certified By"}, "certification_details": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certification Details"}, "params": {"anyOf": [{"$ref": "#/components/schemas/ChartParams-Output"}, {"type": "object"}], "title": "Params"}, "query_context": {"title": "Query Context"}, "cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Cache Timeout"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "is_managed_externally": {"type": "boolean", "title": "Is Managed Externally", "default": false}, "external_url": {"anyOf": [{"type": "string", "minLength": 1, "format": "uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "External Url"}}, "type": "object", "required": ["uuid", "slice_name", "viz_type", "dataset_uuid"], "title": "SupersetChartDef"}, "SupersetColumn": {"properties": {"column_name": {"type": "string", "title": "Column Name"}, "verbose_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Verbose Name"}, "id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "is_dttm": {"type": "boolean", "title": "Is Dttm", "default": false}, "is_active": {"type": "boolean", "title": "Is Active", "default": true}, "type": {"type": "string", "title": "Type", "default": "VARCHAR"}, "type_generic": {"$ref": "#/components/schemas/GenericDataType", "default": 1}, "advanced_data_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Advanced Data Type"}, "groupby": {"type": "boolean", "title": "Groupby", "default": true}, "filterable": {"type": "boolean", "title": "Filterable", "default": true}, "expression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Expression"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "python_date_format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Python Date Format"}, "extra": {"type": "object", "title": "Extra"}}, "type": "object", "required": ["column_name"], "title": "SupersetColumn"}, "SupersetDashboardDef": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "dashboard_title": {"type": "string", "title": "Dashboard Title"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "css": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Css"}, "slug": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Slug"}, "position": {"type": "object", "title": "Position"}, "metadata": {"type": "object", "title": "Metadata"}, "is_managed_externally": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Managed Externally", "default": false}, "external_url": {"anyOf": [{"type": "string", "minLength": 1, "format": "uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "External Url"}, "certified_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certified By"}, "certification_details": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certification Details"}, "published": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Published", "default": false}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["uuid", "dashboard_title"], "title": "SupersetDashboardDef"}, "SupersetDatabaseDef": {"properties": {"database_name": {"type": "string", "title": "Database Name"}, "sqlalchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sqlalchemy Uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, "uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "cache_timeout": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cache Timeout"}, "expose_in_sqllab": {"type": "boolean", "title": "Expose In Sqllab", "default": true}, "allow_run_async": {"type": "boolean", "title": "Allow Run Async", "default": false}, "allow_ctas": {"type": "boolean", "title": "Allow Ctas", "default": false}, "allow_cvas": {"type": "boolean", "title": "Allow Cvas", "default": false}, "allow_dml": {"type": "boolean", "title": "Allow Dml", "default": false}, "allow_file_upload": {"type": "boolean", "title": "Allow File Upload", "default": false}, "extra": {"type": "object", "title": "Extra"}, "impersonate_user": {"type": "boolean", "title": "Impersonate User", "default": false}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "ssh_tunnel": {"type": "null", "title": "Ssh Tunnel"}}, "type": "object", "required": ["database_name", "sqlalchemy_uri", "uuid"], "title": "SupersetDatabaseDef"}, "SupersetDatasetDef-Input": {"properties": {"table_name": {"type": "string", "title": "Table Name"}, "schema": {"type": "string", "title": "Schema"}, "uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "database_uuid": {"type": "string", "format": "uuid", "title": "Database Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "main_dttm_col": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Main Dttm Col"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "default_endpoint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Default Endpoint"}, "offset": {"type": "integer", "title": "Offset", "default": 0}, "cache_timeout": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cache Timeout"}, "catalog": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Catalog"}, "sql": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sql"}, "params": {"title": "Params"}, "template_params": {"title": "Template Params"}, "filter_select_enabled": {"type": "boolean", "title": "Filter Select Enabled", "default": true}, "fetch_values_predicate": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetch Values Predicate"}, "extra": {"type": "object", "title": "Extra"}, "normalize_columns": {"type": "boolean", "title": "Normalize Columns", "default": false}, "always_filter_main_dttm": {"type": "boolean", "title": "Always Filter Main Dttm", "default": false}, "metrics": {"items": {"$ref": "#/components/schemas/SupersetMetric"}, "type": "array", "title": "Metrics"}, "columns": {"items": {"$ref": "#/components/schemas/SupersetColumn"}, "type": "array", "title": "Columns"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["table_name", "schema", "uuid", "database_uuid"], "title": "SupersetDatasetDef"}, "SupersetDatasetDef-Output": {"properties": {"table_name": {"type": "string", "title": "Table Name"}, "schema": {"type": "string", "title": "Schema"}, "uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "database_uuid": {"type": "string", "format": "uuid", "title": "Database Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "main_dttm_col": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Main Dttm Col"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "default_endpoint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Default Endpoint"}, "offset": {"type": "integer", "title": "Offset", "default": 0}, "cache_timeout": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cache Timeout"}, "catalog": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Catalog"}, "sql": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sql"}, "params": {"title": "Params"}, "template_params": {"title": "Template Params"}, "filter_select_enabled": {"type": "boolean", "title": "Filter Select Enabled", "default": true}, "fetch_values_predicate": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetch Values Predicate"}, "extra": {"type": "object", "title": "Extra"}, "normalize_columns": {"type": "boolean", "title": "Normalize Columns", "default": false}, "always_filter_main_dttm": {"type": "boolean", "title": "Always Filter Main Dttm", "default": false}, "metrics": {"items": {"$ref": "#/components/schemas/SupersetMetric"}, "type": "array", "title": "Metrics"}, "columns": {"items": {"$ref": "#/components/schemas/SupersetColumn"}, "type": "array", "title": "Columns"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["table_name", "schema", "uuid", "database_uuid"], "title": "SupersetDatasetDef"}, "SupersetDatasourceBundle-Input": {"properties": {"database": {"$ref": "#/components/schemas/SupersetDatabaseDef"}, "datasets": {"items": {"$ref": "#/components/schemas/SupersetDatasetDef-Input"}, "type": "array", "title": "Datasets"}}, "type": "object", "required": ["database"], "title": "SupersetDatasourceBundle"}, "SupersetDatasourceBundle-Output": {"properties": {"database": {"$ref": "#/components/schemas/SupersetDatabaseDef"}, "datasets": {"items": {"$ref": "#/components/schemas/SupersetDatasetDef-Output"}, "type": "array", "title": "Datasets"}}, "type": "object", "required": ["database"], "title": "SupersetDatasourceBundle"}, "SupersetMetadataDef": {"properties": {"version": {"type": "string", "title": "Version", "default": "1.0.0"}, "type": {"$ref": "#/components/schemas/MetadataType", "default": "SqlaTable"}, "timestamp": {"type": "string", "format": "date-time", "title": "Timestamp", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}}, "type": "object", "title": "SupersetMetadataDef"}, "SupersetMetric": {"properties": {"metric_name": {"type": "string", "title": "Metric Name"}, "verbose_name": {"type": "string", "title": "Verbose Name"}, "expression": {"type": "string", "title": "Expression"}, "metric_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Metric Type"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "d3format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "D3Format"}, "currency": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Currency"}, "extra": {"type": "object", "title": "Extra"}, "warning_text": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Warning Text"}}, "type": "object", "required": ["metric_name", "verbose_name", "expression"], "title": "SupersetMetric"}, "SupersetMitMDatasetBundle-Input": {"properties": {"mitm_dataset": {"$ref": "#/components/schemas/SupersetMitMDatasetDef"}, "datasource_bundle": {"$ref": "#/components/schemas/SupersetDatasourceBundle-Input"}, "visualization_bundle": {"$ref": "#/components/schemas/SupersetVisualizationBundle-Input"}}, "type": "object", "required": ["mitm_dataset", "datasource_bundle"], "title": "SupersetMitMDatasetBundle"}, "SupersetMitMDatasetBundle-Output": {"properties": {"mitm_dataset": {"$ref": "#/components/schemas/SupersetMitMDatasetDef"}, "datasource_bundle": {"$ref": "#/components/schemas/SupersetDatasourceBundle-Output"}, "visualization_bundle": {"$ref": "#/components/schemas/SupersetVisualizationBundle-Output"}}, "type": "object", "required": ["mitm_dataset", "datasource_bundle"], "title": "SupersetMitMDatasetBundle"}, "SupersetMitMDatasetDef": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "dataset_name": {"type": "string", "title": "Dataset Name"}, "mitm": {"$ref": "#/components/schemas/MITM"}, "database_uuid": {"type": "string", "format": "uuid", "title": "Database Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["uuid", "dataset_name", "mitm", "database_uuid"], "title": "SupersetMitMDatasetDef"}, "SupersetPostProcessing-Input": {"properties": {}, "type": "object", "title": "SupersetPostProcessing"}, "SupersetPostProcessing-Output": {"properties": {"operation": {"type": "string", "title": "Operation", "readOnly": true}}, "type": "object", "required": ["operation"], "title": "SupersetPostProcessing"}, "SupersetVisualizationBundle-Input": {"properties": {"charts": {"items": {"$ref": "#/components/schemas/SupersetChartDef-Input"}, "type": "array", "title": "Charts"}, "dashboards": {"items": {"$ref": "#/components/schemas/SupersetDashboardDef"}, "type": "array", "title": "Dashboards"}}, "type": "object", "title": "SupersetVisualizationBundle"}, "SupersetVisualizationBundle-Output": {"properties": {"charts": {"items": {"$ref": "#/components/schemas/SupersetChartDef-Output"}, "type": "array", "title": "Charts"}, "dashboards": {"items": {"$ref": "#/components/schemas/SupersetDashboardDef"}, "type": "array", "title": "Dashboards"}}, "type": "object", "title": "SupersetVisualizationBundle"}, "SupersetVizType": {"type": "string", "enum": ["pie", "echarts_timeseries_bar", "echarts_timeseries_line"], "title": "SupersetVizType"}, "TimeGrain": {"type": "string", "enum": ["PT1S", "PT5S", "PT30S", "PT1M", "PT5M", "PT10M", "PT15M", "PT30M", "PT0.5H", "PT1H", "PT6H", "P1D", "P1W", "1969-12-28T00:00:00Z/P1W", "1969-12-29T00:00:00Z/P1W", "P1W/1970-01-03T00:00:00Z", "P1W/1970-01-04T00:00:00Z", "P1M", "P3M", "P0.25Y", "P1Y"], "title": "TimeGrain"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}}} \ No newline at end of file +{"openapi": "3.1.0", "info": {"title": "SupersetMitMService", "version": "0.1.0"}, "paths": {"/mitm_dataset/upload": {"post": {"tags": ["mitm_dataset"], "summary": "Upload Mitm Dataset", "operationId": "upload_mitm_dataset", "parameters": [{"name": "dataset_name", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Name"}}, {"name": "mitm", "in": "query", "required": false, "schema": {"$ref": "#/components/schemas/MITM", "default": "MAED"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_mitm_dataset_mitm_dataset_upload_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UploadMitMResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/mitm_dataset/register": {"post": {"tags": ["mitm_dataset"], "summary": "Register Mitm Dataset", "operationId": "register_mitm_dataset", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/RegisterExternalMitMDatasetRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RegisterMitMResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/mitm_dataset/": {"get": {"tags": ["mitm_dataset"], "summary": "Get Mitm Datasets", "operationId": "get_mitm_datasets", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/TrackedMitMDataset"}, "type": "array", "title": "Response Get Mitm Datasets Mitm Dataset Get"}}}}}}, "post": {"tags": ["mitm_dataset"], "summary": "Post Mitm Dataset", "operationId": "post_mitm_dataset", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/AddTrackedMitMDatasetRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/mitm_dataset/{uuid}": {"get": {"tags": ["mitm_dataset"], "summary": "Get Mitm Dataset", "operationId": "get_mitm_dataset", "parameters": [{"name": "uuid", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid", "title": "Uuid"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TrackedMitMDataset"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["mitm_dataset"], "summary": "Delete Mitm Dataset", "operationId": "delete_mitm_dataset", "parameters": [{"name": "uuid", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid", "title": "Uuid"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset": {"post": {"tags": ["definitions"], "summary": "Generate Mitm Dataset Bundle", "operationId": "generate_mitm_dataset_bundle", "parameters": [{"name": "dataset_name", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Name"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupersetMitMDatasetBundle"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset/import": {"post": {"tags": ["definitions"], "summary": "Generate Mitm Dataset Import", "operationId": "generate_mitm_dataset_import", "parameters": [{"name": "dataset_name", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Name"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupersetMitMDatasetImport"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset/import/zip": {"post": {"tags": ["definitions"], "summary": "Generate Mitm Dataset Import Zip", "operationId": "generate_mitm_dataset_import_zip", "parameters": [{"name": "dataset_name", "in": "query", "required": true, "schema": {"type": "string", "title": "Dataset Name"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/zip": {}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset/{uuid}/": {"get": {"tags": ["definitions"], "summary": "Generate Uploaded Mitm Dataset Bundle", "operationId": "generate_uploaded_mitm_dataset_bundle", "parameters": [{"name": "uuid", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid", "title": "Uuid"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupersetMitMDatasetBundle"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset/{uuid}/import": {"get": {"tags": ["definitions"], "summary": "Generate Uploaded Mitm Dataset Import", "operationId": "generate_uploaded_mitm_dataset_import", "parameters": [{"name": "uuid", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid", "title": "Uuid"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupersetMitMDatasetImport"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/definitions/mitm_dataset/{uuid}/import/zip": {"get": {"tags": ["definitions"], "summary": "Generate Uploaded Mitm Dataset Import Zip", "operationId": "generate_uploaded_mitm_dataset_import_zip", "parameters": [{"name": "uuid", "in": "path", "required": true, "schema": {"type": "string", "format": "uuid", "title": "Uuid"}}, {"name": "include_visualizations", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Visualizations"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/zip": {}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/": {"get": {"summary": "Root", "operationId": "root__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/health": {"get": {"summary": "Health", "operationId": "health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}}, "components": {"schemas": {"AddTrackedMitMDatasetRequest": {"properties": {"uuid": {"anyOf": [{"type": "string", "format": "uuid"}, {"type": "null"}], "title": "Uuid"}, "dataset_name": {"type": "string", "title": "Dataset Name"}, "schema_name": {"type": "string", "title": "Schema Name"}, "sql_alchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sql Alchemy Uri"}, "mitm_header": {"$ref": "#/components/schemas/Header-Input"}}, "type": "object", "required": ["dataset_name", "schema_name", "sql_alchemy_uri", "mitm_header"], "title": "AddTrackedMitMDatasetRequest"}, "AnnotationLayer": {"properties": {"name": {"type": "string", "title": "Name"}, "value": {"type": "integer", "title": "Value"}, "annotationType": {"$ref": "#/components/schemas/AnnotationType"}, "sourceType": {"$ref": "#/components/schemas/AnnotationSource", "default": "table"}, "opacity": {"type": "string", "title": "Opacity", "default": ""}, "overrides": {"$ref": "#/components/schemas/AnnotationOverrides"}, "hideLine": {"type": "boolean", "title": "Hideline", "default": false}, "show": {"type": "boolean", "title": "Show", "default": false}, "showLabel": {"type": "boolean", "title": "Showlabel", "default": false}, "showMarkers": {"type": "boolean", "title": "Showmarkers", "default": false}, "style": {"type": "string", "title": "Style", "default": "solid"}, "width": {"type": "integer", "title": "Width", "default": 1}}, "type": "object", "required": ["name", "value", "annotationType", "overrides"], "title": "AnnotationLayer"}, "AnnotationOverrides": {"properties": {"time_range": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Range"}}, "type": "object", "title": "AnnotationOverrides"}, "AnnotationSource": {"type": "string", "enum": ["line", "NATIVE", "table", ""], "title": "AnnotationSource"}, "AnnotationType": {"type": "string", "enum": ["EVENT", "FORMULA", "INTERVAL", "TIME_SERIES"], "title": "AnnotationType"}, "Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post": {"properties": {"mitm_header": {"$ref": "#/components/schemas/Header-Input"}, "db_conn_info": {"$ref": "#/components/schemas/SupersetDBConnectionInfo"}}, "type": "object", "required": ["mitm_header", "db_conn_info"], "title": "Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post"}, "Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post": {"properties": {"mitm_header": {"$ref": "#/components/schemas/Header-Input"}, "db_conn_info": {"$ref": "#/components/schemas/SupersetDBConnectionInfo"}}, "type": "object", "required": ["mitm_header", "db_conn_info"], "title": "Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post"}, "Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post": {"properties": {"mitm_header": {"$ref": "#/components/schemas/Header-Input"}, "db_conn_info": {"$ref": "#/components/schemas/SupersetDBConnectionInfo"}}, "type": "object", "required": ["mitm_header", "db_conn_info"], "title": "Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post"}, "Body_upload_mitm_dataset_mitm_dataset_upload_post": {"properties": {"mitm_zip": {"type": "string", "format": "binary", "title": "Mitm Zip"}}, "type": "object", "required": ["mitm_zip"], "title": "Body_upload_mitm_dataset_mitm_dataset_upload_post"}, "ChartDataResultFormat": {"type": "string", "enum": ["csv", "json", "xlsx"], "title": "ChartDataResultFormat"}, "ChartDataResultType": {"type": "string", "enum": ["columns", "full", "query", "results", "samples", "timegrains", "post_processed", "drill_detail"], "title": "ChartDataResultType"}, "ChartParams": {"properties": {"datasource": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/DatasourceIdentifier"}], "title": "Datasource"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "groupby": {"items": {"type": "string"}, "type": "array", "title": "Groupby"}, "adhoc_filters": {"items": {"$ref": "#/components/schemas/SupersetAdhocFilter"}, "type": "array", "title": "Adhoc Filters"}, "row_limit": {"type": "integer", "title": "Row Limit", "default": 10000}, "sort_by_metric": {"type": "boolean", "title": "Sort By Metric", "default": true}, "color_scheme": {"type": "string", "enum": ["blueToGreen", "supersetColors"], "title": "Color Scheme", "default": "supersetColors"}, "show_legend": {"type": "boolean", "title": "Show Legend", "default": true}, "legendType": {"type": "string", "title": "Legendtype", "default": "scroll"}, "legendOrientation": {"type": "string", "title": "Legendorientation", "default": "top"}, "extra_form_data": {"type": "object", "title": "Extra Form Data"}, "slice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Slice Id"}, "dashboards": {"items": {"type": "integer"}, "type": "array", "title": "Dashboards"}}, "type": "object", "required": ["datasource", "viz_type"], "title": "ChartParams"}, "ColName": {"properties": {"name": {"type": "string", "title": "Name"}}, "type": "object", "required": ["name"], "title": "ColName"}, "ColumnOfDataset": {"properties": {"datasetUuid": {"type": "string", "format": "uuid", "title": "Datasetuuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "column": {"$ref": "#/components/schemas/ColName"}}, "type": "object", "required": ["datasetUuid", "column"], "title": "ColumnOfDataset"}, "CompiledVirtualView": {"properties": {"dialect": {"type": "string", "title": "Dialect"}, "compiled_sql": {"type": "string", "title": "Compiled Sql"}, "columns": {"items": {"type": "string"}, "type": "array", "title": "Columns"}, "column_dtypes": {"items": {"anyOf": [{"$ref": "#/components/schemas/WrappedMITMDataType"}, {"type": "string"}]}, "type": "array", "title": "Column Dtypes"}, "name": {"type": "string", "title": "Name"}, "schema_name": {"type": "string", "title": "Schema Name"}}, "type": "object", "required": ["dialect", "compiled_sql", "columns", "column_dtypes", "name", "schema_name"], "title": "CompiledVirtualView"}, "ComponentMeta": {"properties": {}, "type": "object", "title": "ComponentMeta"}, "ConceptMapping": {"properties": {"mitm": {"$ref": "#/components/schemas/MITM"}, "concept": {"type": "string", "title": "Concept"}, "base_table": {"anyOf": [{"$ref": "#/components/schemas/TableIdentifier"}, {"prefixItems": [{"$ref": "#/components/schemas/SourceDBType"}, {"type": "string"}, {"type": "string"}], "type": "array", "maxItems": 3, "minItems": 3}, {"prefixItems": [{"type": "string"}, {"type": "string"}], "type": "array", "maxItems": 2, "minItems": 2}], "title": "Base Table"}, "kind_col": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Kind Col"}, "type_col": {"type": "string", "title": "Type Col"}, "identity_columns": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"items": {"type": "string"}, "type": "array"}], "title": "Identity Columns"}, "inline_relations": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"items": {"type": "string"}, "type": "array"}], "title": "Inline Relations"}, "foreign_relations": {"additionalProperties": {"$ref": "#/components/schemas/ForeignRelation"}, "type": "object", "title": "Foreign Relations"}, "attributes": {"items": {"type": "string"}, "type": "array", "title": "Attributes"}, "attribute_dtypes": {"items": {"$ref": "#/components/schemas/MITMDataType"}, "type": "array", "title": "Attribute Dtypes"}}, "type": "object", "required": ["mitm", "concept", "base_table", "type_col"], "title": "ConceptMapping"}, "ControlValues": {"properties": {"enableEmptyFilter": {"type": "boolean", "title": "Enableemptyfilter", "default": false}, "defaultToFirstItem": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Defaulttofirstitem", "default": false}, "multiSelect": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Multiselect", "default": true}, "searchAllOptions": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Searchalloptions", "default": false}, "inverseSelection": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Inverseselection", "default": false}}, "type": "object", "title": "ControlValues"}, "DashboardComponent": {"properties": {"id": {"type": "string", "title": "Id"}, "type": {"$ref": "#/components/schemas/DashboardComponentType"}, "meta": {"anyOf": [{"$ref": "#/components/schemas/ComponentMeta"}, {"type": "null"}]}, "children": {"items": {"type": "string"}, "type": "array", "title": "Children"}}, "type": "object", "required": ["id", "type"], "title": "DashboardComponent"}, "DashboardComponentType": {"type": "string", "enum": ["CHART", "HEADER", "GRID", "ROW", "ROOT"], "title": "DashboardComponentType"}, "DashboardMetadata": {"properties": {"color_scheme": {"type": "string", "title": "Color Scheme", "default": "blueToGreen"}, "cross_filters_enabled": {"type": "boolean", "title": "Cross Filters Enabled", "default": true}, "native_filter_configuration": {"items": {"$ref": "#/components/schemas/NativeFilterConfig"}, "type": "array", "title": "Native Filter Configuration"}}, "type": "object", "title": "DashboardMetadata"}, "DatasetReference": {"properties": {"datasetUuid": {"type": "string", "format": "uuid", "title": "Datasetuuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}}, "type": "object", "required": ["datasetUuid"], "title": "DatasetReference"}, "DatasourceIdentifier": {"properties": {"id": {"type": "integer", "title": "Id", "default": -1}, "type": {"type": "string", "enum": ["table", "annotation"], "title": "Type", "default": "table"}}, "type": "object", "title": "DatasourceIdentifier"}, "ExpressionType": {"type": "string", "enum": ["SIMPLE", "SQL"], "title": "ExpressionType"}, "FilterOperator": {"type": "string", "enum": ["==", "!=", ">", "<", ">=", "<=", "LIKE", "NOT LIKE", "ILIKE", "IS NULL", "IS NOT NULL", "IN", "NOT IN", "IS TRUE", "IS FALSE", "TEMPORAL_RANGE"], "title": "FilterOperator"}, "FilterStringOperators": {"type": "string", "enum": ["EQUALS", "NOT_EQUALS", "LESS_THAN", "GREATER_THAN", "LESS_THAN_OR_EQUAL", "GREATER_THAN_OR_EQUAL", "IN", "NOT_IN", "ILIKE", "LIKE", "IS_NOT_NULL", "IS_NULL", "LATEST_PARTITION", "IS_TRUE", "IS_FALSE"], "title": "FilterStringOperators"}, "FilterType": {"type": "string", "enum": ["filter_select", "filter_timegrain"], "title": "FilterType"}, "ForeignRelation": {"properties": {"fk_columns": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"items": {"type": "string"}, "type": "array"}], "title": "Fk Columns"}, "referred_table": {"anyOf": [{"$ref": "#/components/schemas/TableIdentifier"}, {"prefixItems": [{"$ref": "#/components/schemas/SourceDBType"}, {"type": "string"}, {"type": "string"}], "type": "array", "maxItems": 3, "minItems": 3}, {"prefixItems": [{"type": "string"}, {"type": "string"}], "type": "array", "maxItems": 2, "minItems": 2}], "title": "Referred Table"}}, "type": "object", "required": ["fk_columns", "referred_table"], "title": "ForeignRelation"}, "FormData": {"properties": {}, "type": "object", "title": "FormData"}, "GenericDataType": {"type": "integer", "enum": [0, 1, 2, 3], "title": "GenericDataType"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Header-Input": {"properties": {"mitm": {"$ref": "#/components/schemas/MITM"}, "header_entries": {"items": {"$ref": "#/components/schemas/HeaderEntry"}, "type": "array", "title": "Header Entries"}}, "type": "object", "required": ["mitm"], "title": "Header"}, "Header-Output": {"properties": {"mitm": {"$ref": "#/components/schemas/MITM"}, "header_entries": {"items": {"$ref": "#/components/schemas/HeaderEntry"}, "type": "array", "title": "Header Entries"}}, "type": "object", "required": ["mitm"], "title": "Header"}, "HeaderEntry": {"properties": {"concept": {"type": "string", "title": "Concept"}, "kind": {"type": "string", "title": "Kind"}, "type_name": {"type": "string", "title": "Type Name"}, "attributes": {"items": {"type": "string"}, "type": "array", "title": "Attributes"}, "attribute_dtypes": {"items": {"$ref": "#/components/schemas/MITMDataType"}, "type": "array", "title": "Attribute Dtypes"}}, "type": "object", "required": ["concept", "kind", "type_name", "attributes", "attribute_dtypes"], "title": "HeaderEntry"}, "MITM": {"type": "string", "enum": ["MAED", "OCEL2"], "title": "MITM"}, "MITMDataType": {"type": "string", "enum": ["text", "json", "integer", "numeric", "boolean", "datetime", "unknown", "infer"], "title": "MITMDataType"}, "MetadataType": {"type": "string", "enum": ["Database", "SqlaTable", "Slice", "Chart", "Dashboard", "Asset", "MitMDataset"], "title": "MetadataType"}, "NativeFilterConfig": {"properties": {"id": {"type": "string", "title": "Id"}, "name": {"type": "string", "title": "Name"}, "targets": {"items": {"anyOf": [{"$ref": "#/components/schemas/DatasetReference"}, {"$ref": "#/components/schemas/ColumnOfDataset"}]}, "type": "array", "title": "Targets"}, "controlValues": {"$ref": "#/components/schemas/ControlValues"}, "filterType": {"$ref": "#/components/schemas/FilterType", "default": "filter_select"}, "type": {"type": "string", "title": "Type", "default": "NATIVE_FILTER"}}, "type": "object", "required": ["id", "name"], "title": "NativeFilterConfig"}, "QueryContext": {"properties": {"datasource": {"$ref": "#/components/schemas/DatasourceIdentifier"}, "queries": {"items": {"$ref": "#/components/schemas/QueryObject"}, "type": "array", "title": "Queries"}, "form_data": {"anyOf": [{"$ref": "#/components/schemas/FormData"}, {"type": "null"}]}, "result_type": {"$ref": "#/components/schemas/ChartDataResultType", "default": "full"}, "result_format": {"$ref": "#/components/schemas/ChartDataResultFormat", "default": "json"}, "force": {"type": "boolean", "title": "Force", "default": false}, "custom_cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Custom Cache Timeout"}}, "type": "object", "required": ["datasource"], "title": "QueryContext"}, "QueryObject": {"properties": {"annotation_layers": {"items": {"$ref": "#/components/schemas/AnnotationLayer"}, "type": "array", "title": "Annotation Layers"}, "applied_time_extras": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Applied Time Extras"}, "columns": {"items": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/SupersetAdhocColumn"}]}, "type": "array", "title": "Columns"}, "datasource": {"anyOf": [{"$ref": "#/components/schemas/DatasourceIdentifier"}, {"type": "null"}]}, "extras": {"$ref": "#/components/schemas/QueryObjectExtras"}, "filters": {"items": {"$ref": "#/components/schemas/QueryObjectFilterClause"}, "type": "array", "title": "Filters"}, "metrics": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetAdhocMetric"}, "type": "array"}, {"type": "null"}], "title": "Metrics"}, "granularity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Granularity"}, "from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "From Dttm"}, "to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "To Dttm"}, "inner_from_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner From Dttm"}, "inner_to_dttm": {"anyOf": [{"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "Inner To Dttm"}, "is_rowcount": {"type": "boolean", "title": "Is Rowcount", "default": false}, "is_timeseries": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Timeseries"}, "order_desc": {"type": "boolean", "title": "Order Desc", "default": true}, "orderby": {"items": {"prefixItems": [{"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric"}, {"type": "string"}]}, {"type": "boolean"}], "type": "array", "maxItems": 2, "minItems": 2}, "type": "array", "title": "Orderby"}, "post_processing": {"items": {"anyOf": [{"$ref": "#/components/schemas/SupersetPostProcessing"}, {"type": "object"}]}, "type": "array", "title": "Post Processing"}, "result_type": {"anyOf": [{"$ref": "#/components/schemas/ChartDataResultType"}, {"type": "null"}]}, "row_limit": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Limit"}, "row_offset": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Row Offset"}, "series_columns": {"items": {"type": "string"}, "type": "array", "title": "Series Columns"}, "series_limit": {"type": "integer", "title": "Series Limit", "default": 0}, "series_limit_metric": {"anyOf": [{"$ref": "#/components/schemas/SupersetAdhocMetric"}, {"type": "null"}]}, "time_offsets": {"items": {"type": "string"}, "type": "array", "title": "Time Offsets"}, "time_shift": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Shift"}, "time_range": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Range"}, "url_params": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Url Params"}}, "type": "object", "title": "QueryObject"}, "QueryObjectExtras": {"properties": {"having": {"type": "string", "title": "Having", "default": ""}, "where": {"type": "string", "title": "Where", "default": ""}, "time_grain_sqla": {"anyOf": [{"$ref": "#/components/schemas/TimeGrain"}, {"type": "null"}]}}, "type": "object", "title": "QueryObjectExtras"}, "QueryObjectFilterClause": {"properties": {"col": {"type": "string", "title": "Col"}, "op": {"$ref": "#/components/schemas/FilterOperator"}, "val": {"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}, {"items": {"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}]}, "type": "array"}, {"prefixItems": [{"anyOf": [{"type": "boolean"}, {"type": "string", "format": "date-time", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}, {"type": "number"}, {"type": "integer"}, {"type": "string"}]}], "type": "array", "maxItems": 1, "minItems": 1}, {"type": "null"}], "title": "Val"}, "grain": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Grain"}, "isExtra": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Isextra"}}, "type": "object", "required": ["col", "op"], "title": "QueryObjectFilterClause"}, "RegisterExternalMitMDatasetRequest": {"properties": {"dataset_name": {"type": "string", "title": "Dataset Name"}, "sql_alchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sql Alchemy Uri"}, "mitm": {"$ref": "#/components/schemas/MITM"}, "cvvs": {"items": {"$ref": "#/components/schemas/CompiledVirtualView"}, "type": "array", "title": "Cvvs"}, "mappings": {"items": {"$ref": "#/components/schemas/ConceptMapping"}, "type": "array", "title": "Mappings"}}, "type": "object", "required": ["dataset_name", "sql_alchemy_uri", "mitm", "cvvs", "mappings"], "title": "RegisterExternalMitMDatasetRequest"}, "RegisterMitMResponse": {"properties": {"status": {"type": "string", "enum": ["success", "failure"], "title": "Status"}, "tracked_mitm_dataset": {"anyOf": [{"$ref": "#/components/schemas/TrackedMitMDataset"}, {"type": "null"}]}, "msg": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Msg"}}, "type": "object", "required": ["status"], "title": "RegisterMitMResponse"}, "RelatedDashboard": {"properties": {"dashboard_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Dashboard Id"}, "dashboard_uuid": {"type": "string", "format": "uuid", "title": "Dashboard Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}}, "type": "object", "required": ["dashboard_uuid"], "title": "RelatedDashboard"}, "RelatedSlice": {"properties": {"slice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Slice Id"}, "slice_uuid": {"type": "string", "format": "uuid", "title": "Slice Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}}, "type": "object", "required": ["slice_uuid"], "title": "RelatedSlice"}, "RelatedTable": {"properties": {"table_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Table Id"}, "table_uuid": {"type": "string", "format": "uuid", "title": "Table Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}}, "type": "object", "required": ["table_uuid"], "title": "RelatedTable"}, "SourceDBType": {"type": "string", "enum": ["original", "working", "virtual"], "title": "SourceDBType"}, "SupersetAdhocColumn": {"properties": {"label": {"type": "string", "title": "Label"}, "sqlExpression": {"type": "string", "title": "Sqlexpression"}, "columnType": {"type": "string", "title": "Columntype", "default": "BASE_AXIS"}, "expressionType": {"type": "string", "title": "Expressiontype", "default": "SQL"}, "timeGrain": {"anyOf": [{"$ref": "#/components/schemas/TimeGrain"}, {"type": "null"}]}}, "type": "object", "required": ["label", "sqlExpression"], "title": "SupersetAdhocColumn"}, "SupersetAdhocFilter": {"properties": {"clause": {"type": "string", "title": "Clause", "default": "WHERE"}, "subject": {"type": "string", "title": "Subject"}, "operator": {"$ref": "#/components/schemas/FilterOperator"}, "operatorId": {"anyOf": [{"$ref": "#/components/schemas/FilterStringOperators"}, {"type": "null"}]}, "comparator": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Comparator", "default": "No filter"}, "expressionType": {"$ref": "#/components/schemas/ExpressionType", "default": "SIMPLE"}, "isExtra": {"type": "boolean", "title": "Isextra", "default": false}, "isNew": {"type": "boolean", "title": "Isnew", "default": false}, "sqlExpression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sqlexpression"}}, "type": "object", "required": ["subject", "operator"], "title": "SupersetAdhocFilter"}, "SupersetAdhocMetric": {"properties": {"label": {"type": "string", "title": "Label"}, "column": {"$ref": "#/components/schemas/SupersetColumn"}, "expressionType": {"$ref": "#/components/schemas/ExpressionType", "default": "SIMPLE"}, "aggregate": {"$ref": "#/components/schemas/SupersetAggregate", "default": "COUNT"}, "sqlExpression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sqlexpression"}, "datasourceWarning": {"type": "boolean", "title": "Datasourcewarning", "default": false}, "hasCustomLabel": {"type": "boolean", "title": "Hascustomlabel", "default": false}, "optionName": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Optionname"}}, "type": "object", "required": ["label", "column"], "title": "SupersetAdhocMetric"}, "SupersetAggregate": {"type": "string", "enum": ["COUNT", "SUM", "MIN", "MAX", "AVG"], "title": "SupersetAggregate"}, "SupersetAssetsImport": {"properties": {"databases": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDatabaseDef"}, "type": "array"}, {"type": "null"}], "title": "Databases"}, "datasets": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDatasetDef"}, "type": "array"}, {"type": "null"}], "title": "Datasets"}, "charts": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetChartDef"}, "type": "array"}, {"type": "null"}], "title": "Charts"}, "dashboards": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetDashboardDef"}, "type": "array"}, {"type": "null"}], "title": "Dashboards"}, "metadata": {"$ref": "#/components/schemas/SupersetMetadataDef"}}, "type": "object", "title": "SupersetAssetsImport"}, "SupersetChartDef": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "slice_name": {"type": "string", "title": "Slice Name"}, "viz_type": {"$ref": "#/components/schemas/SupersetVizType"}, "dataset_uuid": {"type": "string", "format": "uuid", "title": "Dataset Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "certified_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certified By"}, "certification_details": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certification Details"}, "params": {"anyOf": [{"$ref": "#/components/schemas/ChartParams"}, {"type": "null"}]}, "query_context": {"anyOf": [{"$ref": "#/components/schemas/QueryContext"}, {"type": "null"}]}, "cache_timeout": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Cache Timeout"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "is_managed_externally": {"type": "boolean", "title": "Is Managed Externally", "default": false}, "external_url": {"anyOf": [{"type": "string", "minLength": 1, "format": "uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "External Url"}}, "type": "object", "required": ["uuid", "slice_name", "viz_type", "dataset_uuid"], "title": "SupersetChartDef"}, "SupersetColumn": {"properties": {"column_name": {"type": "string", "title": "Column Name"}, "verbose_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Verbose Name"}, "id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "is_dttm": {"type": "boolean", "title": "Is Dttm", "default": false}, "is_active": {"type": "boolean", "title": "Is Active", "default": true}, "type": {"type": "string", "title": "Type", "default": "VARCHAR"}, "type_generic": {"$ref": "#/components/schemas/GenericDataType", "default": 1}, "advanced_data_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Advanced Data Type"}, "groupby": {"type": "boolean", "title": "Groupby", "default": true}, "filterable": {"type": "boolean", "title": "Filterable", "default": true}, "expression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Expression"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "python_date_format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Python Date Format"}, "extra": {"type": "object", "title": "Extra"}}, "type": "object", "required": ["column_name"], "title": "SupersetColumn"}, "SupersetDBConnectionInfo": {"properties": {"sql_alchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sql Alchemy Uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, "explicit_db_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Explicit Db Name"}, "schema_name": {"type": "string", "title": "Schema Name", "default": "main"}}, "type": "object", "required": ["sql_alchemy_uri"], "title": "SupersetDBConnectionInfo"}, "SupersetDashboardDef": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "dashboard_title": {"type": "string", "title": "Dashboard Title"}, "position": {"additionalProperties": {"anyOf": [{"type": "string"}, {"$ref": "#/components/schemas/DashboardComponent"}]}, "type": "object", "title": "Position"}, "metadata": {"$ref": "#/components/schemas/DashboardMetadata"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "css": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Css"}, "slug": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Slug"}, "is_managed_externally": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Managed Externally", "default": false}, "external_url": {"anyOf": [{"type": "string", "minLength": 1, "format": "uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, {"type": "null"}], "title": "External Url"}, "certified_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certified By"}, "certification_details": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Certification Details"}, "published": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Published", "default": false}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["uuid", "dashboard_title", "position", "metadata"], "title": "SupersetDashboardDef"}, "SupersetDatabaseDef": {"properties": {"database_name": {"type": "string", "title": "Database Name"}, "sqlalchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sqlalchemy Uri", "description": "Better annotation for AnyUrl. Parses from string format, serializes to string format."}, "uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "cache_timeout": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cache Timeout"}, "expose_in_sqllab": {"type": "boolean", "title": "Expose In Sqllab", "default": true}, "allow_run_async": {"type": "boolean", "title": "Allow Run Async", "default": false}, "allow_ctas": {"type": "boolean", "title": "Allow Ctas", "default": false}, "allow_cvas": {"type": "boolean", "title": "Allow Cvas", "default": false}, "allow_dml": {"type": "boolean", "title": "Allow Dml", "default": false}, "allow_file_upload": {"type": "boolean", "title": "Allow File Upload", "default": false}, "extra": {"type": "object", "title": "Extra"}, "impersonate_user": {"type": "boolean", "title": "Impersonate User", "default": false}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "ssh_tunnel": {"type": "null", "title": "Ssh Tunnel"}}, "type": "object", "required": ["database_name", "sqlalchemy_uri", "uuid"], "title": "SupersetDatabaseDef"}, "SupersetDatasetDef": {"properties": {"table_name": {"type": "string", "title": "Table Name"}, "schema": {"type": "string", "title": "Schema"}, "uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "database_uuid": {"type": "string", "format": "uuid", "title": "Database Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "main_dttm_col": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Main Dttm Col"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "default_endpoint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Default Endpoint"}, "offset": {"type": "integer", "title": "Offset", "default": 0}, "cache_timeout": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cache Timeout"}, "catalog": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Catalog"}, "sql": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sql"}, "params": {"title": "Params"}, "template_params": {"title": "Template Params"}, "filter_select_enabled": {"type": "boolean", "title": "Filter Select Enabled", "default": true}, "fetch_values_predicate": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetch Values Predicate"}, "extra": {"type": "object", "title": "Extra"}, "normalize_columns": {"type": "boolean", "title": "Normalize Columns", "default": false}, "always_filter_main_dttm": {"type": "boolean", "title": "Always Filter Main Dttm", "default": false}, "metrics": {"items": {"$ref": "#/components/schemas/SupersetMetric"}, "type": "array", "title": "Metrics"}, "columns": {"items": {"$ref": "#/components/schemas/SupersetColumn"}, "type": "array", "title": "Columns"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["table_name", "schema", "uuid", "database_uuid"], "title": "SupersetDatasetDef"}, "SupersetDatasourceBundle": {"properties": {"database": {"$ref": "#/components/schemas/SupersetDatabaseDef"}, "datasets": {"items": {"$ref": "#/components/schemas/SupersetDatasetDef"}, "type": "array", "title": "Datasets"}}, "type": "object", "required": ["database"], "title": "SupersetDatasourceBundle"}, "SupersetMetadataDef": {"properties": {"type": {"$ref": "#/components/schemas/MetadataType"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}, "timestamp": {"type": "string", "format": "date-time", "title": "Timestamp", "description": "Better annotation for datetime. Parses from string format, serializes to string format."}}, "type": "object", "required": ["type"], "title": "SupersetMetadataDef"}, "SupersetMetric": {"properties": {"metric_name": {"type": "string", "title": "Metric Name"}, "verbose_name": {"type": "string", "title": "Verbose Name"}, "expression": {"type": "string", "title": "Expression"}, "metric_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Metric Type"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "d3format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "D3Format"}, "currency": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Currency"}, "extra": {"type": "object", "title": "Extra"}, "warning_text": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Warning Text"}}, "type": "object", "required": ["metric_name", "verbose_name", "expression"], "title": "SupersetMetric"}, "SupersetMitMDatasetBundle": {"properties": {"mitm_dataset": {"$ref": "#/components/schemas/SupersetMitMDatasetDef"}, "datasource_bundle": {"$ref": "#/components/schemas/SupersetDatasourceBundle"}, "visualization_bundle": {"$ref": "#/components/schemas/SupersetVisualizationBundle"}}, "type": "object", "required": ["mitm_dataset", "datasource_bundle"], "title": "SupersetMitMDatasetBundle"}, "SupersetMitMDatasetDef": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "dataset_name": {"type": "string", "title": "Dataset Name"}, "mitm": {"$ref": "#/components/schemas/MITM"}, "mitm_header": {"anyOf": [{"$ref": "#/components/schemas/Header-Output"}, {"type": "null"}]}, "database_uuid": {"type": "string", "format": "uuid", "title": "Database Uuid", "description": "Better annotation for UUID. Parses from string format, serializes to string format."}, "tables": {"anyOf": [{"items": {"$ref": "#/components/schemas/RelatedTable"}, "type": "array"}, {"type": "null"}], "title": "Tables"}, "slices": {"anyOf": [{"items": {"$ref": "#/components/schemas/RelatedSlice"}, "type": "array"}, {"type": "null"}], "title": "Slices"}, "dashboards": {"anyOf": [{"items": {"$ref": "#/components/schemas/RelatedDashboard"}, "type": "array"}, {"type": "null"}], "title": "Dashboards"}, "version": {"type": "string", "title": "Version", "default": "1.0.0"}}, "type": "object", "required": ["uuid", "dataset_name", "mitm", "database_uuid"], "title": "SupersetMitMDatasetDef"}, "SupersetMitMDatasetImport": {"properties": {"mitm_datasets": {"anyOf": [{"items": {"$ref": "#/components/schemas/SupersetMitMDatasetDef"}, "type": "array"}, {"type": "null"}], "title": "Mitm Datasets"}, "base_assets": {"anyOf": [{"$ref": "#/components/schemas/SupersetAssetsImport"}, {"type": "null"}]}, "metadata": {"$ref": "#/components/schemas/SupersetMetadataDef"}}, "type": "object", "required": ["mitm_datasets", "base_assets"], "title": "SupersetMitMDatasetImport"}, "SupersetPostProcessing": {"properties": {"operation": {"type": "string", "title": "Operation", "readOnly": true}}, "type": "object", "required": ["operation"], "title": "SupersetPostProcessing"}, "SupersetVisualizationBundle": {"properties": {"charts": {"items": {"$ref": "#/components/schemas/SupersetChartDef"}, "type": "array", "title": "Charts"}, "dashboards": {"items": {"$ref": "#/components/schemas/SupersetDashboardDef"}, "type": "array", "title": "Dashboards"}}, "type": "object", "title": "SupersetVisualizationBundle"}, "SupersetVizType": {"type": "string", "enum": ["pie", "echarts_timeseries_bar", "echarts_timeseries_line"], "title": "SupersetVizType"}, "TableIdentifier": {"properties": {"source": {"$ref": "#/components/schemas/SourceDBType", "default": "original"}, "schema": {"type": "string", "title": "Schema", "default": "main"}, "name": {"type": "string", "title": "Name"}}, "type": "object", "required": ["name"], "title": "TableIdentifier"}, "TimeGrain": {"type": "string", "enum": ["PT1S", "PT5S", "PT30S", "PT1M", "PT5M", "PT10M", "PT15M", "PT30M", "PT0.5H", "PT1H", "PT6H", "P1D", "P1W", "1969-12-28T00:00:00Z/P1W", "1969-12-29T00:00:00Z/P1W", "P1W/1970-01-03T00:00:00Z", "P1W/1970-01-04T00:00:00Z", "P1M", "P3M", "P0.25Y", "P1Y"], "title": "TimeGrain"}, "TrackedMitMDataset": {"properties": {"uuid": {"type": "string", "format": "uuid", "title": "Uuid"}, "dataset_name": {"type": "string", "title": "Dataset Name"}, "schema_name": {"type": "string", "title": "Schema Name"}, "is_local": {"type": "boolean", "title": "Is Local", "default": true}, "sql_alchemy_uri": {"type": "string", "minLength": 1, "format": "uri", "title": "Sql Alchemy Uri"}, "mitm_header": {"$ref": "#/components/schemas/Header-Output"}}, "type": "object", "required": ["dataset_name", "schema_name", "sql_alchemy_uri", "mitm_header"], "title": "TrackedMitMDataset"}, "UploadMitMResponse": {"properties": {"status": {"type": "string", "enum": ["success", "failure"], "title": "Status"}, "tracked_mitm_dataset": {"anyOf": [{"$ref": "#/components/schemas/TrackedMitMDataset"}, {"type": "null"}]}, "msg": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Msg"}}, "type": "object", "required": ["status"], "title": "UploadMitMResponse"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}, "WrappedMITMDataType": {"properties": {"mitm": {"$ref": "#/components/schemas/MITMDataType"}}, "type": "object", "required": ["mitm"], "title": "WrappedMITMDataType"}}}} \ No newline at end of file diff --git a/schema/openapi.yaml b/schema/openapi.yaml index 05362dcb7c222e42c29ed641dc22405f57025697..abe7fd2c15c83c53fd09cd3ea2f8996f6222ff79 100644 --- a/schema/openapi.yaml +++ b/schema/openapi.yaml @@ -1,5 +1,33 @@ components: schemas: + AddTrackedMitMDatasetRequest: + properties: + dataset_name: + title: Dataset Name + type: string + mitm_header: + $ref: '#/components/schemas/Header-Input' + schema_name: + title: Schema Name + type: string + sql_alchemy_uri: + format: uri + minLength: 1 + title: Sql Alchemy Uri + type: string + uuid: + anyOf: + - format: uuid + type: string + - type: 'null' + title: Uuid + required: + - dataset_name + - schema_name + - sql_alchemy_uri + - mitm_header + title: AddTrackedMitMDatasetRequest + type: object AnnotationLayer: properties: annotationType: @@ -75,18 +103,40 @@ components: - TIME_SERIES title: AnnotationType type: string - Body_generate_mitm_viz_def_definitions_mitm_viz_post: + Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post: properties: - header: - $ref: '#/components/schemas/Header' - mitm_dataset_bundle: - $ref: '#/components/schemas/SupersetMitMDatasetBundle-Input' + db_conn_info: + $ref: '#/components/schemas/SupersetDBConnectionInfo' + mitm_header: + $ref: '#/components/schemas/Header-Input' required: - - header - - mitm_dataset_bundle - title: Body_generate_mitm_viz_def_definitions_mitm_viz_post + - mitm_header + - db_conn_info + title: Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post type: object - Body_upload_mitm_dataset_upload_mitm_dataset_post: + Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post: + properties: + db_conn_info: + $ref: '#/components/schemas/SupersetDBConnectionInfo' + mitm_header: + $ref: '#/components/schemas/Header-Input' + required: + - mitm_header + - db_conn_info + title: Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post + type: object + Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post: + properties: + db_conn_info: + $ref: '#/components/schemas/SupersetDBConnectionInfo' + mitm_header: + $ref: '#/components/schemas/Header-Input' + required: + - mitm_header + - db_conn_info + title: Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post + type: object + Body_upload_mitm_dataset_mitm_dataset_upload_post: properties: mitm_zip: format: binary @@ -94,7 +144,7 @@ components: type: string required: - mitm_zip - title: Body_upload_mitm_dataset_upload_mitm_dataset_post + title: Body_upload_mitm_dataset_mitm_dataset_upload_post type: object ChartDataResultFormat: enum: @@ -115,7 +165,7 @@ components: - drill_detail title: ChartDataResultType type: string - ChartParams-Input: + ChartParams: properties: adhoc_filters: items: @@ -137,7 +187,7 @@ components: datasource: anyOf: - type: string - - $ref: '#/components/schemas/DatasourceIdentifier-Input' + - $ref: '#/components/schemas/DatasourceIdentifier' title: Datasource extra_form_data: title: Extra Form Data @@ -179,97 +229,236 @@ components: - viz_type title: ChartParams type: object - ChartParams-Output: + ColName: properties: - adhoc_filters: + name: + title: Name + type: string + required: + - name + title: ColName + type: object + ColumnOfDataset: + properties: + column: + $ref: '#/components/schemas/ColName' + datasetUuid: + description: Better annotation for UUID. Parses from string format, serializes + to string format. + format: uuid + title: Datasetuuid + type: string + required: + - datasetUuid + - column + title: ColumnOfDataset + type: object + CompiledVirtualView: + properties: + column_dtypes: items: - $ref: '#/components/schemas/SupersetAdhocFilter' - title: Adhoc Filters + anyOf: + - $ref: '#/components/schemas/WrappedMITMDataType' + - type: string + title: Column Dtypes type: array - color_scheme: - default: supersetColors - enum: - - blueToGreen - - supersetColors - title: Color Scheme + columns: + items: + type: string + title: Columns + type: array + compiled_sql: + title: Compiled Sql type: string - dashboards: + dialect: + title: Dialect + type: string + name: + title: Name + type: string + schema_name: + title: Schema Name + type: string + required: + - dialect + - compiled_sql + - columns + - column_dtypes + - name + - schema_name + title: CompiledVirtualView + type: object + ComponentMeta: + properties: {} + title: ComponentMeta + type: object + ConceptMapping: + properties: + attribute_dtypes: items: - type: integer - title: Dashboards + $ref: '#/components/schemas/MITMDataType' + title: Attribute Dtypes type: array - datasource: - anyOf: - - type: string - - $ref: '#/components/schemas/DatasourceIdentifier-Output' - title: Datasource - extra_form_data: - title: Extra Form Data - type: object - groupby: + attributes: items: type: string - title: Groupby + title: Attributes type: array - legendOrientation: - default: top - title: Legendorientation + base_table: + anyOf: + - $ref: '#/components/schemas/TableIdentifier' + - maxItems: 3 + minItems: 3 + prefixItems: + - $ref: '#/components/schemas/SourceDBType' + - type: string + - type: string + type: array + - maxItems: 2 + minItems: 2 + prefixItems: + - type: string + - type: string + type: array + title: Base Table + concept: + title: Concept type: string - legendType: - default: scroll - title: Legendtype + foreign_relations: + additionalProperties: + $ref: '#/components/schemas/ForeignRelation' + title: Foreign Relations + type: object + identity_columns: + anyOf: + - additionalProperties: + type: string + type: object + - items: + type: string + type: array + title: Identity Columns + inline_relations: + anyOf: + - additionalProperties: + type: string + type: object + - items: + type: string + type: array + title: Inline Relations + kind_col: + anyOf: + - type: string + - type: 'null' + title: Kind Col + mitm: + $ref: '#/components/schemas/MITM' + type_col: + title: Type Col type: string - row_limit: - default: 10000 - title: Row Limit - type: integer - show_legend: - default: true - title: Show Legend + required: + - mitm + - concept + - base_table + - type_col + title: ConceptMapping + type: object + ControlValues: + properties: + defaultToFirstItem: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Defaulttofirstitem + enableEmptyFilter: + default: false + title: Enableemptyfilter type: boolean - slice_id: + inverseSelection: anyOf: - - type: integer + - type: boolean + - type: 'null' + default: false + title: Inverseselection + multiSelect: + anyOf: + - type: boolean - type: 'null' - title: Slice Id - sort_by_metric: default: true - title: Sort By Metric - type: boolean - viz_type: - $ref: '#/components/schemas/SupersetVizType' + title: Multiselect + searchAllOptions: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Searchalloptions + title: ControlValues + type: object + DashboardComponent: + properties: + children: + items: + type: string + title: Children + type: array + id: + title: Id + type: string + meta: + anyOf: + - $ref: '#/components/schemas/ComponentMeta' + - type: 'null' + type: + $ref: '#/components/schemas/DashboardComponentType' required: - - datasource - - viz_type - title: ChartParams + - id + - type + title: DashboardComponent type: object - DatasourceIdentifier-Input: + DashboardComponentType: + enum: + - CHART + - HEADER + - GRID + - ROW + - ROOT + title: DashboardComponentType + type: string + DashboardMetadata: properties: - dataset_uuid: + color_scheme: + default: blueToGreen + title: Color Scheme + type: string + cross_filters_enabled: + default: true + title: Cross Filters Enabled + type: boolean + native_filter_configuration: + items: + $ref: '#/components/schemas/NativeFilterConfig' + title: Native Filter Configuration + type: array + title: DashboardMetadata + type: object + DatasetReference: + properties: + datasetUuid: description: Better annotation for UUID. Parses from string format, serializes to string format. format: uuid - title: Dataset Uuid - type: string - id: - default: placeholder - title: Id - type: integer - type: - default: table - enum: - - table - - annotation - title: Type + title: Datasetuuid type: string required: - - dataset_uuid - title: DatasourceIdentifier + - datasetUuid + title: DatasetReference type: object - DatasourceIdentifier-Output: + DatasourceIdentifier: properties: id: - default: placeholder + default: -1 title: Id type: integer type: @@ -326,6 +515,45 @@ components: - IS_FALSE title: FilterStringOperators type: string + FilterType: + enum: + - filter_select + - filter_timegrain + title: FilterType + type: string + ForeignRelation: + properties: + fk_columns: + anyOf: + - additionalProperties: + type: string + type: object + - items: + type: string + type: array + title: Fk Columns + referred_table: + anyOf: + - $ref: '#/components/schemas/TableIdentifier' + - maxItems: 3 + minItems: 3 + prefixItems: + - $ref: '#/components/schemas/SourceDBType' + - type: string + - type: string + type: array + - maxItems: 2 + minItems: 2 + prefixItems: + - type: string + - type: string + type: array + title: Referred Table + required: + - fk_columns + - referred_table + title: ForeignRelation + type: object FormData: properties: {} title: FormData @@ -347,7 +575,20 @@ components: type: array title: HTTPValidationError type: object - Header: + Header-Input: + properties: + header_entries: + items: + $ref: '#/components/schemas/HeaderEntry' + title: Header Entries + type: array + mitm: + $ref: '#/components/schemas/MITM' + required: + - mitm + title: Header + type: object + Header-Output: properties: header_entries: items: @@ -418,29 +659,36 @@ components: - MitMDataset title: MetadataType type: string - MitMDatasetImportResponse: - properties: - base_assets: - $ref: '#/components/schemas/SupersetAssetsDef' - definition_bundle: - $ref: '#/components/schemas/SupersetMitMDatasetBundle-Output' - required: - - definition_bundle - - base_assets - title: MitMDatasetImportResponse - type: object - MitMVisualizationResponse: + NativeFilterConfig: properties: - base_assets: - $ref: '#/components/schemas/SupersetAssetsDef' - definition_bundle: - $ref: '#/components/schemas/SupersetMitMDatasetBundle-Output' + controlValues: + $ref: '#/components/schemas/ControlValues' + filterType: + $ref: '#/components/schemas/FilterType' + default: filter_select + id: + title: Id + type: string + name: + title: Name + type: string + targets: + items: + anyOf: + - $ref: '#/components/schemas/DatasetReference' + - $ref: '#/components/schemas/ColumnOfDataset' + title: Targets + type: array + type: + default: NATIVE_FILTER + title: Type + type: string required: - - definition_bundle - - base_assets - title: MitMVisualizationResponse + - id + - name + title: NativeFilterConfig type: object - QueryContext-Input: + QueryContext: properties: custom_cache_timeout: anyOf: @@ -448,7 +696,7 @@ components: - type: 'null' title: Custom Cache Timeout datasource: - $ref: '#/components/schemas/DatasourceIdentifier-Input' + $ref: '#/components/schemas/DatasourceIdentifier' force: default: false title: Force @@ -456,12 +704,10 @@ components: form_data: anyOf: - $ref: '#/components/schemas/FormData' - - type: object - type: 'null' - title: Form Data queries: items: - $ref: '#/components/schemas/QueryObject-Input' + $ref: '#/components/schemas/QueryObject' title: Queries type: array result_format: @@ -474,198 +720,7 @@ components: - datasource title: QueryContext type: object - QueryContext-Output: - properties: - custom_cache_timeout: - anyOf: - - type: integer - - type: 'null' - title: Custom Cache Timeout - datasource: - $ref: '#/components/schemas/DatasourceIdentifier-Output' - force: - default: false - title: Force - type: boolean - form_data: - anyOf: - - $ref: '#/components/schemas/FormData' - - type: object - - type: 'null' - title: Form Data - queries: - items: - $ref: '#/components/schemas/QueryObject-Output' - title: Queries - type: array - result_format: - $ref: '#/components/schemas/ChartDataResultFormat' - default: json - result_type: - $ref: '#/components/schemas/ChartDataResultType' - default: full - required: - - datasource - title: QueryContext - type: object - QueryObject-Input: - properties: - annotation_layers: - items: - $ref: '#/components/schemas/AnnotationLayer' - title: Annotation Layers - type: array - applied_time_extras: - additionalProperties: - type: string - title: Applied Time Extras - type: object - columns: - items: - anyOf: - - type: string - - $ref: '#/components/schemas/SupersetAdhocColumn' - title: Columns - type: array - datasource: - anyOf: - - $ref: '#/components/schemas/DatasourceIdentifier-Input' - - type: 'null' - extras: - $ref: '#/components/schemas/QueryObjectExtras' - filters: - items: - $ref: '#/components/schemas/QueryObjectFilterClause' - title: Filters - type: array - from_dttm: - anyOf: - - description: Better annotation for datetime. Parses from string format, - serializes to string format. - format: date-time - type: string - - type: 'null' - title: From Dttm - granularity: - anyOf: - - type: string - - type: 'null' - title: Granularity - inner_from_dttm: - anyOf: - - description: Better annotation for datetime. Parses from string format, - serializes to string format. - format: date-time - type: string - - type: 'null' - title: Inner From Dttm - inner_to_dttm: - anyOf: - - description: Better annotation for datetime. Parses from string format, - serializes to string format. - format: date-time - type: string - - type: 'null' - title: Inner To Dttm - is_rowcount: - default: false - title: Is Rowcount - type: boolean - is_timeseries: - anyOf: - - type: boolean - - type: 'null' - title: Is Timeseries - metrics: - anyOf: - - items: - $ref: '#/components/schemas/SupersetAdhocMetric-Input' - type: array - - type: 'null' - title: Metrics - order_desc: - default: true - title: Order Desc - type: boolean - orderby: - items: - maxItems: 2 - minItems: 2 - prefixItems: - - anyOf: - - $ref: '#/components/schemas/SupersetAdhocMetric-Input' - - type: string - - type: boolean - type: array - title: Orderby - type: array - post_processing: - items: - anyOf: - - $ref: '#/components/schemas/SupersetPostProcessing-Input' - - type: object - title: Post Processing - type: array - result_type: - anyOf: - - $ref: '#/components/schemas/ChartDataResultType' - - type: 'null' - row_limit: - anyOf: - - type: integer - - type: 'null' - title: Row Limit - row_offset: - anyOf: - - type: integer - - type: 'null' - title: Row Offset - series_columns: - items: - type: string - title: Series Columns - type: array - series_limit: - default: 0 - title: Series Limit - type: integer - series_limit_metric: - anyOf: - - $ref: '#/components/schemas/SupersetAdhocMetric-Input' - - type: 'null' - time_offsets: - items: - type: string - title: Time Offsets - type: array - time_range: - anyOf: - - type: string - - type: 'null' - title: Time Range - time_shift: - anyOf: - - type: string - - type: 'null' - title: Time Shift - to_dttm: - anyOf: - - description: Better annotation for datetime. Parses from string format, - serializes to string format. - format: date-time - type: string - - type: 'null' - title: To Dttm - url_params: - anyOf: - - additionalProperties: - type: string - type: object - - type: 'null' - title: Url Params - title: QueryObject - type: object - QueryObject-Output: + QueryObject: properties: annotation_layers: items: @@ -686,7 +741,7 @@ components: type: array datasource: anyOf: - - $ref: '#/components/schemas/DatasourceIdentifier-Output' + - $ref: '#/components/schemas/DatasourceIdentifier' - type: 'null' extras: $ref: '#/components/schemas/QueryObjectExtras' @@ -736,7 +791,7 @@ components: metrics: anyOf: - items: - $ref: '#/components/schemas/SupersetAdhocMetric-Output' + $ref: '#/components/schemas/SupersetAdhocMetric' type: array - type: 'null' title: Metrics @@ -750,7 +805,7 @@ components: minItems: 2 prefixItems: - anyOf: - - $ref: '#/components/schemas/SupersetAdhocMetric-Output' + - $ref: '#/components/schemas/SupersetAdhocMetric' - type: string - type: boolean type: array @@ -759,7 +814,7 @@ components: post_processing: items: anyOf: - - $ref: '#/components/schemas/SupersetPostProcessing-Output' + - $ref: '#/components/schemas/SupersetPostProcessing' - type: object title: Post Processing type: array @@ -788,7 +843,7 @@ components: type: integer series_limit_metric: anyOf: - - $ref: '#/components/schemas/SupersetAdhocMetric-Output' + - $ref: '#/components/schemas/SupersetAdhocMetric' - type: 'null' time_offsets: items: @@ -896,6 +951,115 @@ components: - op title: QueryObjectFilterClause type: object + RegisterExternalMitMDatasetRequest: + properties: + cvvs: + items: + $ref: '#/components/schemas/CompiledVirtualView' + title: Cvvs + type: array + dataset_name: + title: Dataset Name + type: string + mappings: + items: + $ref: '#/components/schemas/ConceptMapping' + title: Mappings + type: array + mitm: + $ref: '#/components/schemas/MITM' + sql_alchemy_uri: + format: uri + minLength: 1 + title: Sql Alchemy Uri + type: string + required: + - dataset_name + - sql_alchemy_uri + - mitm + - cvvs + - mappings + title: RegisterExternalMitMDatasetRequest + type: object + RegisterMitMResponse: + properties: + msg: + anyOf: + - type: string + - type: 'null' + title: Msg + status: + enum: + - success + - failure + title: Status + type: string + tracked_mitm_dataset: + anyOf: + - $ref: '#/components/schemas/TrackedMitMDataset' + - type: 'null' + required: + - status + title: RegisterMitMResponse + type: object + RelatedDashboard: + properties: + dashboard_id: + anyOf: + - type: integer + - type: 'null' + title: Dashboard Id + dashboard_uuid: + description: Better annotation for UUID. Parses from string format, serializes + to string format. + format: uuid + title: Dashboard Uuid + type: string + required: + - dashboard_uuid + title: RelatedDashboard + type: object + RelatedSlice: + properties: + slice_id: + anyOf: + - type: integer + - type: 'null' + title: Slice Id + slice_uuid: + description: Better annotation for UUID. Parses from string format, serializes + to string format. + format: uuid + title: Slice Uuid + type: string + required: + - slice_uuid + title: RelatedSlice + type: object + RelatedTable: + properties: + table_id: + anyOf: + - type: integer + - type: 'null' + title: Table Id + table_uuid: + description: Better annotation for UUID. Parses from string format, serializes + to string format. + format: uuid + title: Table Uuid + type: string + required: + - table_uuid + title: RelatedTable + type: object + SourceDBType: + enum: + - original + - working + - virtual + title: SourceDBType + type: string SupersetAdhocColumn: properties: columnType: @@ -963,7 +1127,7 @@ components: - operator title: SupersetAdhocFilter type: object - SupersetAdhocMetric-Input: + SupersetAdhocMetric: properties: aggregate: $ref: '#/components/schemas/SupersetAggregate' @@ -999,57 +1163,21 @@ components: - column title: SupersetAdhocMetric type: object - SupersetAdhocMetric-Output: - properties: - aggregate: - $ref: '#/components/schemas/SupersetAggregate' - default: COUNT - column: - $ref: '#/components/schemas/SupersetColumn' - datasourceWarning: - default: false - title: Datasourcewarning - type: boolean - expressionType: - $ref: '#/components/schemas/ExpressionType' - default: SIMPLE - hasCustomLabel: - default: false - title: Hascustomlabel - type: boolean - label: - title: Label - type: string - optionName: - anyOf: - - type: string - - type: 'null' - title: Optionname - sqlExpression: - anyOf: - - type: string - - type: 'null' - title: Sqlexpression - required: - - label - - column - title: SupersetAdhocMetric - type: object - SupersetAggregate: - enum: - - COUNT - - SUM - - MIN - - MAX - - AVG - title: SupersetAggregate - type: string - SupersetAssetsDef: + SupersetAggregate: + enum: + - COUNT + - SUM + - MIN + - MAX + - AVG + title: SupersetAggregate + type: string + SupersetAssetsImport: properties: charts: anyOf: - items: - $ref: '#/components/schemas/SupersetChartDef-Output' + $ref: '#/components/schemas/SupersetChartDef' type: array - type: 'null' title: Charts @@ -1070,15 +1198,15 @@ components: datasets: anyOf: - items: - $ref: '#/components/schemas/SupersetDatasetDef-Output' + $ref: '#/components/schemas/SupersetDatasetDef' type: array - type: 'null' title: Datasets metadata: $ref: '#/components/schemas/SupersetMetadataDef' - title: SupersetAssetsDef + title: SupersetAssetsImport type: object - SupersetChartDef-Input: + SupersetChartDef: properties: cache_timeout: anyOf: @@ -1121,87 +1249,12 @@ components: type: boolean params: anyOf: - - $ref: '#/components/schemas/ChartParams-Input' - - type: object - title: Params - query_context: - anyOf: - - contentMediaType: application/json - contentSchema: {} - type: string - - $ref: '#/components/schemas/QueryContext-Input' - - type: 'null' - title: Query Context - slice_name: - title: Slice Name - type: string - uuid: - description: Better annotation for UUID. Parses from string format, serializes - to string format. - format: uuid - title: Uuid - type: string - version: - default: 1.0.0 - title: Version - type: string - viz_type: - $ref: '#/components/schemas/SupersetVizType' - required: - - uuid - - slice_name - - viz_type - - dataset_uuid - title: SupersetChartDef - type: object - SupersetChartDef-Output: - properties: - cache_timeout: - anyOf: - - type: integer - - type: 'null' - title: Cache Timeout - certification_details: - anyOf: - - type: string - - type: 'null' - title: Certification Details - certified_by: - anyOf: - - type: string - - type: 'null' - title: Certified By - dataset_uuid: - description: Better annotation for UUID. Parses from string format, serializes - to string format. - format: uuid - title: Dataset Uuid - type: string - description: - anyOf: - - type: string + - $ref: '#/components/schemas/ChartParams' - type: 'null' - title: Description - external_url: + query_context: anyOf: - - description: Better annotation for AnyUrl. Parses from string format, - serializes to string format. - format: uri - minLength: 1 - type: string + - $ref: '#/components/schemas/QueryContext' - type: 'null' - title: External Url - is_managed_externally: - default: false - title: Is Managed Externally - type: boolean - params: - anyOf: - - $ref: '#/components/schemas/ChartParams-Output' - - type: object - title: Params - query_context: - title: Query Context slice_name: title: Slice Name type: string @@ -1289,6 +1342,28 @@ components: - column_name title: SupersetColumn type: object + SupersetDBConnectionInfo: + properties: + explicit_db_name: + anyOf: + - type: string + - type: 'null' + title: Explicit Db Name + schema_name: + default: main + title: Schema Name + type: string + sql_alchemy_uri: + description: Better annotation for AnyUrl. Parses from string format, serializes + to string format. + format: uri + minLength: 1 + title: Sql Alchemy Uri + type: string + required: + - sql_alchemy_uri + title: SupersetDBConnectionInfo + type: object SupersetDashboardDef: properties: certification_details: @@ -1330,9 +1405,12 @@ components: default: false title: Is Managed Externally metadata: - title: Metadata - type: object + $ref: '#/components/schemas/DashboardMetadata' position: + additionalProperties: + anyOf: + - type: string + - $ref: '#/components/schemas/DashboardComponent' title: Position type: object published: @@ -1359,6 +1437,8 @@ components: required: - uuid - dashboard_title + - position + - metadata title: SupersetDashboardDef type: object SupersetDatabaseDef: @@ -1428,106 +1508,7 @@ components: - uuid title: SupersetDatabaseDef type: object - SupersetDatasetDef-Input: - properties: - always_filter_main_dttm: - default: false - title: Always Filter Main Dttm - type: boolean - cache_timeout: - anyOf: - - type: string - - type: 'null' - title: Cache Timeout - catalog: - anyOf: - - type: string - - type: 'null' - title: Catalog - columns: - items: - $ref: '#/components/schemas/SupersetColumn' - title: Columns - type: array - database_uuid: - description: Better annotation for UUID. Parses from string format, serializes - to string format. - format: uuid - title: Database Uuid - type: string - default_endpoint: - anyOf: - - type: string - - type: 'null' - title: Default Endpoint - description: - anyOf: - - type: string - - type: 'null' - title: Description - extra: - title: Extra - type: object - fetch_values_predicate: - anyOf: - - type: string - - type: 'null' - title: Fetch Values Predicate - filter_select_enabled: - default: true - title: Filter Select Enabled - type: boolean - main_dttm_col: - anyOf: - - type: string - - type: 'null' - title: Main Dttm Col - metrics: - items: - $ref: '#/components/schemas/SupersetMetric' - title: Metrics - type: array - normalize_columns: - default: false - title: Normalize Columns - type: boolean - offset: - default: 0 - title: Offset - type: integer - params: - title: Params - schema: - title: Schema - type: string - sql: - anyOf: - - type: string - - type: 'null' - title: Sql - table_name: - title: Table Name - type: string - template_params: - title: Template Params - uuid: - description: Better annotation for UUID. Parses from string format, serializes - to string format. - format: uuid - title: Uuid - type: string - version: - default: 1.0.0 - title: Version - type: string - required: - - table_name - - schema - - uuid - - database_uuid - title: SupersetDatasetDef - type: object - SupersetDatasetDef-Output: + SupersetDatasetDef: properties: always_filter_main_dttm: default: false @@ -1626,26 +1607,13 @@ components: - database_uuid title: SupersetDatasetDef type: object - SupersetDatasourceBundle-Input: - properties: - database: - $ref: '#/components/schemas/SupersetDatabaseDef' - datasets: - items: - $ref: '#/components/schemas/SupersetDatasetDef-Input' - title: Datasets - type: array - required: - - database - title: SupersetDatasourceBundle - type: object - SupersetDatasourceBundle-Output: + SupersetDatasourceBundle: properties: database: $ref: '#/components/schemas/SupersetDatabaseDef' datasets: items: - $ref: '#/components/schemas/SupersetDatasetDef-Output' + $ref: '#/components/schemas/SupersetDatasetDef' title: Datasets type: array required: @@ -1662,11 +1630,12 @@ components: type: string type: $ref: '#/components/schemas/MetadataType' - default: SqlaTable version: default: 1.0.0 title: Version type: string + required: + - type title: SupersetMetadataDef type: object SupersetMetric: @@ -1714,27 +1683,14 @@ components: - expression title: SupersetMetric type: object - SupersetMitMDatasetBundle-Input: - properties: - datasource_bundle: - $ref: '#/components/schemas/SupersetDatasourceBundle-Input' - mitm_dataset: - $ref: '#/components/schemas/SupersetMitMDatasetDef' - visualization_bundle: - $ref: '#/components/schemas/SupersetVisualizationBundle-Input' - required: - - mitm_dataset - - datasource_bundle - title: SupersetMitMDatasetBundle - type: object - SupersetMitMDatasetBundle-Output: + SupersetMitMDatasetBundle: properties: datasource_bundle: - $ref: '#/components/schemas/SupersetDatasourceBundle-Output' + $ref: '#/components/schemas/SupersetDatasourceBundle' mitm_dataset: $ref: '#/components/schemas/SupersetMitMDatasetDef' visualization_bundle: - $ref: '#/components/schemas/SupersetVisualizationBundle-Output' + $ref: '#/components/schemas/SupersetVisualizationBundle' required: - mitm_dataset - datasource_bundle @@ -1742,6 +1698,13 @@ components: type: object SupersetMitMDatasetDef: properties: + dashboards: + anyOf: + - items: + $ref: '#/components/schemas/RelatedDashboard' + type: array + - type: 'null' + title: Dashboards database_uuid: description: Better annotation for UUID. Parses from string format, serializes to string format. @@ -1753,6 +1716,24 @@ components: type: string mitm: $ref: '#/components/schemas/MITM' + mitm_header: + anyOf: + - $ref: '#/components/schemas/Header-Output' + - type: 'null' + slices: + anyOf: + - items: + $ref: '#/components/schemas/RelatedSlice' + type: array + - type: 'null' + title: Slices + tables: + anyOf: + - items: + $ref: '#/components/schemas/RelatedTable' + type: array + - type: 'null' + title: Tables uuid: description: Better annotation for UUID. Parses from string format, serializes to string format. @@ -1770,11 +1751,27 @@ components: - database_uuid title: SupersetMitMDatasetDef type: object - SupersetPostProcessing-Input: - properties: {} - title: SupersetPostProcessing + SupersetMitMDatasetImport: + properties: + base_assets: + anyOf: + - $ref: '#/components/schemas/SupersetAssetsImport' + - type: 'null' + metadata: + $ref: '#/components/schemas/SupersetMetadataDef' + mitm_datasets: + anyOf: + - items: + $ref: '#/components/schemas/SupersetMitMDatasetDef' + type: array + - type: 'null' + title: Mitm Datasets + required: + - mitm_datasets + - base_assets + title: SupersetMitMDatasetImport type: object - SupersetPostProcessing-Output: + SupersetPostProcessing: properties: operation: readOnly: true @@ -1784,25 +1781,11 @@ components: - operation title: SupersetPostProcessing type: object - SupersetVisualizationBundle-Input: + SupersetVisualizationBundle: properties: charts: items: - $ref: '#/components/schemas/SupersetChartDef-Input' - title: Charts - type: array - dashboards: - items: - $ref: '#/components/schemas/SupersetDashboardDef' - title: Dashboards - type: array - title: SupersetVisualizationBundle - type: object - SupersetVisualizationBundle-Output: - properties: - charts: - items: - $ref: '#/components/schemas/SupersetChartDef-Output' + $ref: '#/components/schemas/SupersetChartDef' title: Charts type: array dashboards: @@ -1819,6 +1802,22 @@ components: - echarts_timeseries_line title: SupersetVizType type: string + TableIdentifier: + properties: + name: + title: Name + type: string + schema: + default: main + title: Schema + type: string + source: + $ref: '#/components/schemas/SourceDBType' + default: original + required: + - name + title: TableIdentifier + type: object TimeGrain: enum: - PT1S @@ -1844,6 +1843,57 @@ components: - P1Y title: TimeGrain type: string + TrackedMitMDataset: + properties: + dataset_name: + title: Dataset Name + type: string + is_local: + default: true + title: Is Local + type: boolean + mitm_header: + $ref: '#/components/schemas/Header-Output' + schema_name: + title: Schema Name + type: string + sql_alchemy_uri: + format: uri + minLength: 1 + title: Sql Alchemy Uri + type: string + uuid: + format: uuid + title: Uuid + type: string + required: + - dataset_name + - schema_name + - sql_alchemy_uri + - mitm_header + title: TrackedMitMDataset + type: object + UploadMitMResponse: + properties: + msg: + anyOf: + - type: string + - type: 'null' + title: Msg + status: + enum: + - success + - failure + title: Status + type: string + tracked_mitm_dataset: + anyOf: + - $ref: '#/components/schemas/TrackedMitMDataset' + - type: 'null' + required: + - status + title: UploadMitMResponse + type: object ValidationError: properties: loc: @@ -1865,6 +1915,14 @@ components: - type title: ValidationError type: object + WrappedMITMDataType: + properties: + mitm: + $ref: '#/components/schemas/MITMDataType' + required: + - mitm + title: WrappedMITMDataType + type: object info: title: SupersetMitMService version: 0.1.0 @@ -1882,7 +1940,7 @@ paths: summary: Root /definitions/mitm_dataset: post: - operationId: generate_mitm_dataset_def + operationId: generate_mitm_dataset_bundle parameters: - in: query name: dataset_name @@ -1890,18 +1948,25 @@ paths: schema: title: Dataset Name type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean requestBody: content: application/json: schema: - $ref: '#/components/schemas/Header' + $ref: '#/components/schemas/Body_generate_mitm_dataset_bundle_definitions_mitm_dataset_post' required: true responses: '200': content: application/json: schema: - $ref: '#/components/schemas/MitMDatasetImportResponse' + $ref: '#/components/schemas/SupersetMitMDatasetBundle' description: Successful Response '422': content: @@ -1909,24 +1974,38 @@ paths: schema: $ref: '#/components/schemas/HTTPValidationError' description: Validation Error - summary: Generate Mitm Dataset Def + summary: Generate Mitm Dataset Bundle tags: - definitions - /definitions/mitm_viz: + /definitions/mitm_dataset/import: post: - operationId: generate_mitm_viz_def + operationId: generate_mitm_dataset_import + parameters: + - in: query + name: dataset_name + required: true + schema: + title: Dataset Name + type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean requestBody: content: application/json: schema: - $ref: '#/components/schemas/Body_generate_mitm_viz_def_definitions_mitm_viz_post' + $ref: '#/components/schemas/Body_generate_mitm_dataset_import_definitions_mitm_dataset_import_post' required: true responses: '200': content: application/json: schema: - $ref: '#/components/schemas/MitMVisualizationResponse' + $ref: '#/components/schemas/SupersetMitMDatasetImport' description: Successful Response '422': content: @@ -1934,18 +2013,229 @@ paths: schema: $ref: '#/components/schemas/HTTPValidationError' description: Validation Error - summary: Generate Mitm Viz Def + summary: Generate Mitm Dataset Import tags: - definitions - /upload/mitm_dataset: + /definitions/mitm_dataset/import/zip: + post: + operationId: generate_mitm_dataset_import_zip + parameters: + - in: query + name: dataset_name + required: true + schema: + title: Dataset Name + type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Body_generate_mitm_dataset_import_zip_definitions_mitm_dataset_import_zip_post' + required: true + responses: + '200': + content: + application/zip: {} + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Mitm Dataset Import Zip + tags: + - definitions + /definitions/mitm_dataset/{uuid}/: + get: + operationId: generate_uploaded_mitm_dataset_bundle + parameters: + - in: path + name: uuid + required: true + schema: + format: uuid + title: Uuid + type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SupersetMitMDatasetBundle' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Uploaded Mitm Dataset Bundle + tags: + - definitions + /definitions/mitm_dataset/{uuid}/import: + get: + operationId: generate_uploaded_mitm_dataset_import + parameters: + - in: path + name: uuid + required: true + schema: + format: uuid + title: Uuid + type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SupersetMitMDatasetImport' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Uploaded Mitm Dataset Import + tags: + - definitions + /definitions/mitm_dataset/{uuid}/import/zip: + get: + operationId: generate_uploaded_mitm_dataset_import_zip + parameters: + - in: path + name: uuid + required: true + schema: + format: uuid + title: Uuid + type: string + - in: query + name: include_visualizations + required: false + schema: + default: false + title: Include Visualizations + type: boolean + responses: + '200': + content: + application/zip: {} + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Uploaded Mitm Dataset Import Zip + tags: + - definitions + /health: + get: + operationId: health_health_get + responses: + '200': + content: + application/json: + schema: {} + description: Successful Response + summary: Health + /mitm_dataset/: + get: + operationId: get_mitm_datasets + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TrackedMitMDataset' + title: Response Get Mitm Datasets Mitm Dataset Get + type: array + description: Successful Response + summary: Get Mitm Datasets + tags: + - mitm_dataset + post: + operationId: post_mitm_dataset + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddTrackedMitMDatasetRequest' + required: true + responses: + '200': + content: + application/json: + schema: {} + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Post Mitm Dataset + tags: + - mitm_dataset + /mitm_dataset/register: + post: + operationId: register_mitm_dataset + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RegisterExternalMitMDatasetRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RegisterMitMResponse' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Register Mitm Dataset + tags: + - mitm_dataset + /mitm_dataset/upload: post: operationId: upload_mitm_dataset parameters: - in: query - name: dataset_identifier + name: dataset_name required: true schema: - title: Dataset Identifier + title: Dataset Name type: string - in: query name: mitm @@ -1957,13 +2247,14 @@ paths: content: multipart/form-data: schema: - $ref: '#/components/schemas/Body_upload_mitm_dataset_upload_mitm_dataset_post' + $ref: '#/components/schemas/Body_upload_mitm_dataset_mitm_dataset_upload_post' required: true responses: '200': content: application/json: - schema: {} + schema: + $ref: '#/components/schemas/UploadMitMResponse' description: Successful Response '422': content: @@ -1973,16 +2264,56 @@ paths: description: Validation Error summary: Upload Mitm Dataset tags: - - upload - /upload/mitm_datasets: - get: - operationId: get_mitm_datasets + - mitm_dataset + /mitm_dataset/{uuid}: + delete: + operationId: delete_mitm_dataset + parameters: + - in: path + name: uuid + required: true + schema: + format: uuid + title: Uuid + type: string responses: '200': content: application/json: schema: {} description: Successful Response - summary: Get Mitm Datasets + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Delete Mitm Dataset + tags: + - mitm_dataset + get: + operationId: get_mitm_dataset + parameters: + - in: path + name: uuid + required: true + schema: + format: uuid + title: Uuid + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TrackedMitMDataset' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get Mitm Dataset tags: - - upload + - mitm_dataset diff --git a/startup.sh b/startup.sh index a0ddd85f58080b67cfe778e5ecd0a45329b85fea..d302c287f32681b57426d3a99485e4af45dcc66e 100644 --- a/startup.sh +++ b/startup.sh @@ -1 +1 @@ -fastapi run app/main.py --port "${API_PORT:-8180}" \ No newline at end of file +fastapi run app/main.py --reload --port "${API_PORT:-8180}" \ No newline at end of file diff --git a/test/definitions.http b/test/definitions.http index 00a25ab3a6aeab14b2f7d8f754726d2fc161746c..2603ba6b1a52864029fb16fc5f447dbe5880d96f 100644 --- a/test/definitions.http +++ b/test/definitions.http @@ -1,17 +1,14 @@ -GET http://localhost:8180/ +GET http://localhost:8180/definitions/mitm_dataset/{{uuid}}?include_visualizations=True +Accept: application/json ### -POST http://localhost:8180/definitions/mitm_dataset?dataset_name=myname +GET http://localhost:8180/definitions/mitm_dataset/{{uuid}}/import?include_visualizations=True Accept: application/json -Content-Type: application/json - -< ./synthetic-header.json ### -POST http://localhost:8180/definitions/mitm_viz -Accept: application/json -Content-Type: application/json +GET http://localhost:8180/definitions/uploaded_mitm_dataset/{{uuid}}/import/zip?include_visualizations=True +Accept: application/zip -< ./generate-view-request.json +### \ No newline at end of file diff --git a/test/http-client.env.json b/test/http-client.env.json new file mode 100644 index 0000000000000000000000000000000000000000..13d17c5f26c314b70dec886075c8d9eca84d27b6 --- /dev/null +++ b/test/http-client.env.json @@ -0,0 +1,5 @@ +{ + "dev": { + "uuid": "4259f878-78d1-4fa4-bdc2-ae27b30d44bd" + } +} \ No newline at end of file diff --git a/test/superset-passthrough.http b/test/superset-passthrough.http new file mode 100644 index 0000000000000000000000000000000000000000..4b91f98e463aa6cb3097aa66627d228e743e586c --- /dev/null +++ b/test/superset-passthrough.http @@ -0,0 +1,3 @@ +GET http://localhost:8088/api/v1/mitm_service/call/health + +### \ No newline at end of file diff --git a/test/upload.http b/test/upload.http index 91a3d5fb1e705281c211d5113c9c5be3c528669f..6f94014b1aa59fce558759c5757ee98ac8f4bd7b 100644 --- a/test/upload.http +++ b/test/upload.http @@ -1,4 +1,4 @@ -POST http://localhost:8180/upload/mitm_dataset?dataset_identifier=myname_0&mitm=MAED +POST http://localhost:8180/mitm_dataset/upload?dataset_name=myname_0&mitm=MAED Accept: application/json Content-Type: multipart/form-data; boundary=WebAppBoundary @@ -11,4 +11,27 @@ Content-Type: application/zip ### -GET http://localhost:8180/upload/mitm_datasets \ No newline at end of file +GET http://localhost:8180/mitm_dataset/ + +### + +POST http://localhost:8180/mitm_dataset/upload?dataset_name=myname_1&mitm=MAED +Accept: application/json +Content-Type: multipart/form-data; boundary=WebAppBoundary + +--WebAppBoundary +Content-Disposition: form-data; name="mitm_zip"; filename="synthetic-variation.maed" +Content-Type: application/zip + +< ./synthetic.maed +--WebAppBoundary-- + +### + +GET http://localhost:8180/mitm_dataset/ + +### + +GET http://localhost:8180/mitm_dataset/64b8601b-6edb-493d-a9a1-484d346e0a02 + +### \ No newline at end of file