diff --git a/docker-compose.yml b/docker-compose.yml index 19dcba82fbce99092d5c116b79bc8c9c28e1f7cd..08ca1bc528ca8b0e339d4b60b52e9873d1a5f403 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,9 +22,6 @@ # unique random secure passwords and SECRET_KEY. # ----------------------------------------------------------------------- x-superset-user: &superset-user root -x-superset-depends-on: &superset-depends-on - - db - - redis x-superset-volumes: &superset-volumes # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container - ./docker:/app/docker @@ -193,7 +190,6 @@ services: required: true - path: docker/.env-local # optional override required: false - depends_on: *superset-depends-on volumes: *superset-volumes superset-worker: @@ -274,6 +270,7 @@ services: healthcheck: test: ["CMD-SHELL", "celery inspect ping -A superset.tasks.celery_app:app -d celery@$$HOSTNAME"] + #superset-mitm-service: # build: # context: "C:/Users/leah/PycharmProjects/superset-mitm-service" diff --git a/docker/.env b/docker/.env index c36fdf4c21c10ed5b023004afe855105b7e75944..1917d700732c6f5231bfdce597f446ad556ee972 100644 --- a/docker/.env +++ b/docker/.env @@ -74,3 +74,10 @@ SUPERSET_LOG_LEVEL=info MITM_API_HOST=superset-mitm-service MITM_API_PORT=8180 GLOBAL_ASYNC_QUERIES_JWT_SECRET=c7ced009fa8f8fe00319cdfb137ed97ee7373243daff44f18b50a77d57cd1fb173b2195d4c683a1d4bef15383a423fb274250e5ed2b1b6ed40114952c2fff79a41e92e91e86739894c7c1fe40ad64fcba07e6da23fa76c2b36fa2bcb49db192b061f9bd99627cdf8dfb9b4ffcde33005eade4431cd662eb0265112132e0c478545b62860fa6c1a5a0e3c3d55aa4c121c648becbea68d2ea353fa2165ad543cf3ddc5fa783ec1b53eb738f4ad1cc76fffe526cdfdff070ee409eb8186334ecefffaf385da1f780e6a347169fb0252f606e9f3b9f9b759a5a02de2ecadec531149981898d12dbd8f661bba828a1cf1d4d713848a42ee7b811d0f44870ef7e53fd3 + +MITM_DATABASE_DIALECT= +MITM_DATABASE_USER= +MITM_DATABASE_PASSWORD= +MITM_DATABASE_HOST= +MITM_DATABASE_PORT= +MITM_DATABASE_DB= diff --git a/pyproject.toml b/pyproject.toml index ea41fe3faf4d68ff7839a7f31f747918162d0173..ab0809bc89fbf080c24c358b47ff5188124c522f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,9 +100,6 @@ dependencies = [ "wtforms>=2.3.3, <4", "wtforms-json", "xlsxwriter>=3.0.7, <3.1", - # NEW MITM RELATED - #"requests>=2.0.0" - #"mitm-tooling>=0.3.1" ] [project.optional-dependencies] @@ -207,6 +204,10 @@ development = [ "sqloxide", "statsd", ] +# NEW MITM RELATED + #"requests>=2.0.0" + #"mitm-tooling>=0.3.1" +mitm = ["pydantic>=2.0"] [project.urls] homepage = "https://superset.apache.org/" diff --git a/requirements/base.txt b/requirements/base.txt index 391290ba39adcc4f926bb50311bd14cebda0399f..26d18acd6671ed69307896689fd01d5c3a177a09 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -49,6 +49,7 @@ cffi==1.17.1 # via # cryptography # pynacl + # trio charset-normalizer==3.4.0 # via requests click==8.1.7 @@ -72,6 +73,7 @@ click-repl==0.3.0 colorama==0.4.6 # via # apache-superset (pyproject.toml) + # click # flask-appbuilder cron-descriptor==1.4.5 # via apache-superset (pyproject.toml) @@ -148,8 +150,7 @@ greenlet==3.0.3 # via # apache-superset (pyproject.toml) # shillelagh -gunicorn==23.0.0 - # via apache-superset (pyproject.toml) + # sqlalchemy h11==0.14.0 # via wsproto hashids==1.3.1 @@ -237,7 +238,6 @@ packaging==24.2 # apache-superset (pyproject.toml) # apispec # deprecation - # gunicorn # limits # marshmallow # marshmallow-sqlalchemy @@ -396,6 +396,8 @@ vine==5.1.0 # amqp # celery # kombu +waitress==3.0.2 + # via apache-superset (pyproject.toml) wcwidth==0.2.13 # via prompt-toolkit websocket-client==1.8.0 diff --git a/requirements/development.in b/requirements/development.in index 99584560e58bbe1ed9ad6417cb039f1b642812a7..514536023a2e4015d9d61be5ba26f37a8ff28b5c 100644 --- a/requirements/development.in +++ b/requirements/development.in @@ -16,4 +16,5 @@ # specific language governing permissions and limitations # under the License. # --e .[development,bigquery,cors,druid,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails] +-e .[development,bigquery,cors,druid,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails,mitm] +datamodel-code-generator>=0.28.0 diff --git a/requirements/development.txt b/requirements/development.txt index 230f14150d19354ac4243d00a07211b599a8d891..1ae07efae85d3071fe0b2c2081ed4248a063e5dd 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -10,6 +10,8 @@ amqp==5.3.1 # via # -c requirements/base.txt # kombu +annotated-types==0.7.0 + # via pydantic apispec==6.3.0 # via # -c requirements/base.txt @@ -18,6 +20,8 @@ apsw==3.46.0.0 # via # -c requirements/base.txt # shillelagh +argcomplete==3.5.3 + # via datamodel-code-generator attrs==24.2.0 # via # -c requirements/base.txt @@ -42,6 +46,8 @@ billiard==4.2.1 # via # -c requirements/base.txt # celery +black==25.1.0 + # via datamodel-code-generator blinker==1.9.0 # via # -c requirements/base.txt @@ -80,7 +86,9 @@ cffi==1.17.1 # via # -c requirements/base.txt # cryptography + # gevent # pynacl + # trio cfgv==3.4.0 # via pre-commit charset-normalizer==3.4.0 @@ -91,6 +99,7 @@ click==8.1.7 # via # -c requirements/base.txt # apache-superset + # black # celery # click-didyoumean # click-option-group @@ -120,7 +129,10 @@ colorama==0.4.6 # via # -c requirements/base.txt # apache-superset + # click # flask-appbuilder + # pytest + # tqdm contourpy==1.0.7 # via matplotlib coverage==7.6.8 @@ -141,6 +153,8 @@ cryptography==43.0.3 # pyopenssl cycler==0.12.1 # via matplotlib +datamodel-code-generator==0.28.1 + # via -r requirements/development.in db-dtypes==1.3.1 # via pandas-gbq defusedxml==0.7.1 @@ -251,6 +265,8 @@ freezegun==1.5.1 # via apache-superset future==1.0.0 # via pyhive +genson==1.3.0 + # via datamodel-code-generator geographiclib==2.0 # via # -c requirements/base.txt @@ -306,6 +322,7 @@ greenlet==3.0.3 # apache-superset # gevent # shillelagh + # sqlalchemy grpcio==1.68.0 # via # apache-superset @@ -313,10 +330,6 @@ grpcio==1.68.0 # grpcio-status grpcio-status==1.60.1 # via google-api-core -gunicorn==23.0.0 - # via - # -c requirements/base.txt - # apache-superset h11==0.14.0 # via # -c requirements/base.txt @@ -351,12 +364,16 @@ importlib-resources==6.4.5 # -c requirements/base.txt # limits # prophet +inflect==5.6.2 + # via datamodel-code-generator iniconfig==2.0.0 # via pytest isodate==0.7.2 # via # -c requirements/base.txt # apache-superset +isort==6.0.1 + # via datamodel-code-generator itsdangerous==2.2.0 # via # -c requirements/base.txt @@ -365,6 +382,7 @@ itsdangerous==2.2.0 jinja2==3.1.5 # via # -c requirements/base.txt + # datamodel-code-generator # flask # flask-babel jsonpath-ng==1.7.0 @@ -439,6 +457,8 @@ msgspec==0.18.6 # via # -c requirements/base.txt # flask-session +mypy-extensions==1.0.0 + # via black mysqlclient==2.2.6 # via apache-superset nh3==0.2.19 @@ -487,11 +507,12 @@ packaging==24.2 # -c requirements/base.txt # apache-superset # apispec + # black + # datamodel-code-generator # db-dtypes # deprecation # docker # google-cloud-bigquery - # gunicorn # limits # marshmallow # marshmallow-sqlalchemy @@ -522,6 +543,8 @@ parsedatetime==2.6 # apache-superset pathable==0.4.3 # via jsonschema-spec +pathspec==0.12.1 + # via black pgsanity==0.2.9 # via # -c requirements/base.txt @@ -533,6 +556,7 @@ pillow==10.3.0 platformdirs==3.9.1 # via # -c requirements/base.txt + # black # requests-cache # virtualenv pluggy==1.5.0 @@ -595,6 +619,12 @@ pycparser==2.22 # via # -c requirements/base.txt # cffi +pydantic==2.10.6 + # via + # apache-superset + # datamodel-code-generator +pydantic-core==2.27.2 + # via pydantic pydata-google-auth==1.9.0 # via pandas-gbq pydruid==0.6.9 @@ -677,6 +707,8 @@ pytz==2024.2 # flask-babel # pandas # trino +pywin32==308 + # via docker pyxlsb==1.0.10 # via # -c requirements/base.txt @@ -686,6 +718,7 @@ pyyaml==6.0.2 # -c requirements/base.txt # apache-superset # apispec + # datamodel-code-generator # jsonschema-spec # pre-commit redis==4.6.0 @@ -800,6 +833,8 @@ tabulate==0.8.10 # via # -c requirements/base.txt # apache-superset +tomli==2.2.1 + # via datamodel-code-generator tqdm==4.67.1 # via # cmdstanpy @@ -822,6 +857,8 @@ typing-extensions==4.12.2 # apache-superset # flask-limiter # limits + # pydantic + # pydantic-core # selenium # shillelagh tzdata==2024.2 @@ -830,6 +867,7 @@ tzdata==2024.2 # celery # kombu # pandas + # tzlocal tzlocal==5.2 # via trino url-normalize==1.4.3 @@ -851,6 +889,10 @@ vine==5.1.0 # kombu virtualenv==20.29.2 # via pre-commit +waitress==3.0.2 + # via + # -c requirements/base.txt + # apache-superset wcwidth==0.2.13 # via # -c requirements/base.txt diff --git a/starrocks-compose.yml b/starrocks-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..2f0f182b1627b5799e628ec586701287bf14c100 --- /dev/null +++ b/starrocks-compose.yml @@ -0,0 +1,113 @@ +services: + minio: + container_name: minio + environment: + MINIO_ROOT_USER: miniouser + MINIO_ROOT_PASSWORD: miniopassword + image: minio/minio:latest + ports: + - "9001:9001" + - "9000:9000" + entrypoint: sh + command: '-c ''mkdir -p /minio_data/starrocks && minio server /minio_data --console-address ":9001"''' + healthcheck: + test: ["CMD", "mc", "ready", "local"] + interval: 5s + timeout: 5s + retries: 5 + + minio_mc: + # This service is short lived, it does this: + # - starts up + # - checks to see if the MinIO service `minio` is ready + # - creates a MinIO Access Key that the StarRocks services will use + # - exits + image: minio/mc:latest + entrypoint: + - sh + - -c + - | + until mc ls minio > /dev/null 2>&1; do + sleep 0.5 + done + + mc alias set myminio http://minio:9000 miniouser miniopassword + mc admin user svcacct add --access-key AAAAAAAAAAAAAAAAAAAA \ + --secret-key BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB \ + myminio \ + miniouser + depends_on: + minio: + condition: service_healthy + + starrocks-fe: + image: starrocks/fe-ubuntu:3.3-latest + hostname: starrocks-fe + container_name: starrocks-fe + user: root + command: + - /bin/bash + - -c + - | + echo "# enable shared data, set storage type, set endpoint" >> /opt/starrocks/fe/conf/fe.conf + echo "run_mode = shared_data" >> /opt/starrocks/fe/conf/fe.conf + echo "cloud_native_storage_type = S3" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_endpoint = minio:9000" >> /opt/starrocks/fe/conf/fe.conf + + echo "# set the path in MinIO" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_path = starrocks" >> /opt/starrocks/fe/conf/fe.conf + + echo "# credentials for MinIO object read/write" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_access_key = AAAAAAAAAAAAAAAAAAAA" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_secret_key = BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_use_instance_profile = false" >> /opt/starrocks/fe/conf/fe.conf + echo "aws_s3_use_aws_sdk_default_behavior = false" >> /opt/starrocks/fe/conf/fe.conf + + echo "# Set this to false if you do not want default" >> /opt/starrocks/fe/conf/fe.conf + echo "# storage created in the object storage using" >> /opt/starrocks/fe/conf/fe.conf + echo "# the details provided above" >> /opt/starrocks/fe/conf/fe.conf + echo "enable_load_volume_from_conf = true" >> /opt/starrocks/fe/conf/fe.conf + + /opt/starrocks/fe/bin/start_fe.sh --host_type FQDN + ports: + - 8030:8030 + - 9020:9020 + - 9030:9030 + healthcheck: + test: 'mysql -u root -h starrocks-fe -P 9030 -e "show frontends\G" |grep "Alive: true"' + interval: 10s + timeout: 5s + retries: 3 + depends_on: + minio: + condition: service_healthy + + starrocks-cn: + image: starrocks/cn-ubuntu:3.3-latest + command: + - /bin/bash + - -c + - | + sleep 15s; + ulimit -u 65535; + ulimit -n 65535; + mysql --connect-timeout 2 -h starrocks-fe -P9030 -uroot -e "ALTER SYSTEM ADD COMPUTE NODE \"starrocks-cn:9050\";" + /opt/starrocks/cn/bin/start_cn.sh + environment: + - HOST_TYPE=FQDN + ports: + - 8040:8040 + hostname: starrocks-cn + container_name: starrocks-cn + user: root + depends_on: + starrocks-fe: + condition: service_healthy + restart: true + minio: + condition: service_healthy + healthcheck: + test: 'mysql -u root -h starrocks-fe -P 9030 -e "SHOW COMPUTE NODES\G" |grep "Alive: true"' + interval: 10s + timeout: 5s + retries: 3 diff --git a/superset/config.py b/superset/config.py index 053b2c047a20044a0b369f726343c3e7a377de3b..fbc6fc8281c9d788d244c75543fbef8413bc60a8 100644 --- a/superset/config.py +++ b/superset/config.py @@ -48,6 +48,7 @@ from pandas._libs.parsers import STR_NA_VALUES from sqlalchemy.engine.url import URL from sqlalchemy.orm.query import Query +from docker.pythonpath_dev.superset_config_docker import MITM_DATABASE_URI from superset.advanced_data_type.plugins.internet_address import internet_address from superset.advanced_data_type.plugins.internet_port import internet_port from superset.advanced_data_type.types import AdvancedDataType @@ -560,6 +561,10 @@ DEFAULT_FEATURE_FLAGS: dict[str, bool] = { "SLACK_ENABLE_AVATARS": False, # Allow users to optionally specify date formats in email subjects, which will be parsed if enabled. # noqa: E501 "DATE_FORMAT_IN_EMAIL_SUBJECT": False, + ################################### + # NEW + ################################### + "MITM_SUPPORT" : False, } # ------------------------------ @@ -1922,8 +1927,8 @@ CATALOGS_SIMPLIFIED_MIGRATION: bool = False # MITM_API_BASEURL = 'http://0.0.0.0:8180/' - -MITM_API_TIMEOUT = int(timedelta(seconds=300).total_seconds()) +MITM_API_TIMEOUT = int(timedelta(minutes=5).total_seconds()) +MITM_DATABASE_URI = 'sqlite:///:memory:' # ------------------------------------------------------------------- # * WARNING: STOP EDITING HERE * diff --git a/superset/customization/mitm_service/call_service.py b/superset/customization/mitm_service/call_service.py index 1eb1618d5059288ca02bb42abc170269720fa921..9954dfa8d1e929bf79782821a6057500d74027fd 100644 --- a/superset/customization/mitm_service/call_service.py +++ b/superset/customization/mitm_service/call_service.py @@ -42,4 +42,7 @@ class CallMitMService(BaseSupersetApi): def get_result(self, cache_key: str): # cache_key = request.args['cache_key'] data = external_service_call_manager.retrieve_job_result_json(cache_key) - return self.response(200, **data) + if data is not None: + return self.response(200, **data) + else: + return self.response(404) diff --git a/superset/external_service_apis/__init__.py b/superset/external_service_apis/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/superset/external_service_apis/mitm/__init__.py b/superset/external_service_apis/mitm/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/superset/external_service_apis/mitm/justfile b/superset/external_service_apis/mitm/justfile new file mode 100644 index 0000000000000000000000000000000000000000..9abbeee18203c4ec1487f487229f916a165f93a0 --- /dev/null +++ b/superset/external_service_apis/mitm/justfile @@ -0,0 +1,4 @@ +set windows-powershell := true + +api-schema: + datamodel-codegen --input openapi.yaml --input-file-type openapi --output schema.py --output-model-type pydantic_v2.BaseModel --use-union-operator --use-field-description --target-python-version 3.11 --use-standard-collections --use-subclass-enum --capitalise-enum-members diff --git a/superset/external_service_apis/mitm/openapi.json b/superset/external_service_apis/mitm/openapi.json new file mode 100644 index 0000000000000000000000000000000000000000..0b1bec5e570f8d8b2851b984ec7a22de704a754b --- /dev/null +++ b/superset/external_service_apis/mitm/openapi.json @@ -0,0 +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 diff --git a/superset/external_service_apis/mitm/openapi.yaml b/superset/external_service_apis/mitm/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..05362dcb7c222e42c29ed641dc22405f57025697 --- /dev/null +++ b/superset/external_service_apis/mitm/openapi.yaml @@ -0,0 +1,1988 @@ +components: + schemas: + AnnotationLayer: + properties: + annotationType: + $ref: '#/components/schemas/AnnotationType' + hideLine: + default: false + title: Hideline + type: boolean + name: + title: Name + type: string + opacity: + default: '' + title: Opacity + type: string + overrides: + $ref: '#/components/schemas/AnnotationOverrides' + show: + default: false + title: Show + type: boolean + showLabel: + default: false + title: Showlabel + type: boolean + showMarkers: + default: false + title: Showmarkers + type: boolean + sourceType: + $ref: '#/components/schemas/AnnotationSource' + default: table + style: + default: solid + title: Style + type: string + value: + title: Value + type: integer + width: + default: 1 + title: Width + type: integer + required: + - name + - value + - annotationType + - overrides + title: AnnotationLayer + type: object + AnnotationOverrides: + properties: + time_range: + anyOf: + - type: string + - type: 'null' + title: Time Range + title: AnnotationOverrides + type: object + AnnotationSource: + enum: + - line + - NATIVE + - table + - '' + title: AnnotationSource + type: string + AnnotationType: + enum: + - EVENT + - FORMULA + - INTERVAL + - TIME_SERIES + title: AnnotationType + type: string + Body_generate_mitm_viz_def_definitions_mitm_viz_post: + properties: + header: + $ref: '#/components/schemas/Header' + mitm_dataset_bundle: + $ref: '#/components/schemas/SupersetMitMDatasetBundle-Input' + required: + - header + - mitm_dataset_bundle + title: Body_generate_mitm_viz_def_definitions_mitm_viz_post + type: object + Body_upload_mitm_dataset_upload_mitm_dataset_post: + properties: + mitm_zip: + format: binary + title: Mitm Zip + type: string + required: + - mitm_zip + title: Body_upload_mitm_dataset_upload_mitm_dataset_post + type: object + ChartDataResultFormat: + enum: + - csv + - json + - xlsx + title: ChartDataResultFormat + type: string + ChartDataResultType: + enum: + - columns + - full + - query + - results + - samples + - timegrains + - post_processed + - drill_detail + title: ChartDataResultType + type: string + ChartParams-Input: + properties: + adhoc_filters: + items: + $ref: '#/components/schemas/SupersetAdhocFilter' + title: Adhoc Filters + type: array + color_scheme: + default: supersetColors + enum: + - blueToGreen + - supersetColors + title: Color Scheme + type: string + dashboards: + items: + type: integer + title: Dashboards + type: array + datasource: + anyOf: + - type: string + - $ref: '#/components/schemas/DatasourceIdentifier-Input' + title: Datasource + extra_form_data: + title: Extra Form Data + type: object + groupby: + items: + type: string + title: Groupby + type: array + legendOrientation: + default: top + title: Legendorientation + type: string + legendType: + default: scroll + title: Legendtype + type: string + row_limit: + default: 10000 + title: Row Limit + type: integer + show_legend: + default: true + title: Show Legend + type: boolean + slice_id: + anyOf: + - type: integer + - type: 'null' + title: Slice Id + sort_by_metric: + default: true + title: Sort By Metric + type: boolean + viz_type: + $ref: '#/components/schemas/SupersetVizType' + required: + - datasource + - viz_type + title: ChartParams + type: object + ChartParams-Output: + properties: + adhoc_filters: + items: + $ref: '#/components/schemas/SupersetAdhocFilter' + title: Adhoc Filters + type: array + color_scheme: + default: supersetColors + enum: + - blueToGreen + - supersetColors + title: Color Scheme + type: string + dashboards: + items: + type: integer + title: Dashboards + type: array + datasource: + anyOf: + - type: string + - $ref: '#/components/schemas/DatasourceIdentifier-Output' + title: Datasource + extra_form_data: + title: Extra Form Data + type: object + groupby: + items: + type: string + title: Groupby + type: array + legendOrientation: + default: top + title: Legendorientation + type: string + legendType: + default: scroll + title: Legendtype + type: string + row_limit: + default: 10000 + title: Row Limit + type: integer + show_legend: + default: true + title: Show Legend + type: boolean + slice_id: + anyOf: + - type: integer + - type: 'null' + title: Slice Id + sort_by_metric: + default: true + title: Sort By Metric + type: boolean + viz_type: + $ref: '#/components/schemas/SupersetVizType' + required: + - datasource + - viz_type + title: ChartParams + type: object + DatasourceIdentifier-Input: + properties: + dataset_uuid: + 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 + type: string + required: + - dataset_uuid + title: DatasourceIdentifier + type: object + DatasourceIdentifier-Output: + properties: + id: + default: placeholder + title: Id + type: integer + type: + default: table + enum: + - table + - annotation + title: Type + type: string + title: DatasourceIdentifier + type: object + ExpressionType: + enum: + - SIMPLE + - SQL + title: ExpressionType + type: string + FilterOperator: + enum: + - == + - '!=' + - '>' + - < + - '>=' + - <= + - LIKE + - NOT LIKE + - ILIKE + - IS NULL + - IS NOT NULL + - IN + - NOT IN + - IS TRUE + - IS FALSE + - TEMPORAL_RANGE + title: FilterOperator + type: string + FilterStringOperators: + 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 + type: string + FormData: + properties: {} + title: FormData + type: object + GenericDataType: + enum: + - 0 + - 1 + - 2 + - 3 + title: GenericDataType + type: integer + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + title: Detail + type: array + title: HTTPValidationError + type: object + Header: + properties: + header_entries: + items: + $ref: '#/components/schemas/HeaderEntry' + title: Header Entries + type: array + mitm: + $ref: '#/components/schemas/MITM' + required: + - mitm + title: Header + type: object + HeaderEntry: + properties: + attribute_dtypes: + items: + $ref: '#/components/schemas/MITMDataType' + title: Attribute Dtypes + type: array + attributes: + items: + type: string + title: Attributes + type: array + concept: + title: Concept + type: string + kind: + title: Kind + type: string + type_name: + title: Type Name + type: string + required: + - concept + - kind + - type_name + - attributes + - attribute_dtypes + title: HeaderEntry + type: object + MITM: + enum: + - MAED + - OCEL2 + title: MITM + type: string + MITMDataType: + enum: + - text + - json + - integer + - numeric + - boolean + - datetime + - unknown + - infer + title: MITMDataType + type: string + MetadataType: + enum: + - Database + - SqlaTable + - Slice + - Chart + - Dashboard + - Asset + - 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: + properties: + base_assets: + $ref: '#/components/schemas/SupersetAssetsDef' + definition_bundle: + $ref: '#/components/schemas/SupersetMitMDatasetBundle-Output' + required: + - definition_bundle + - base_assets + title: MitMVisualizationResponse + type: object + QueryContext-Input: + properties: + custom_cache_timeout: + anyOf: + - type: integer + - type: 'null' + title: Custom Cache Timeout + datasource: + $ref: '#/components/schemas/DatasourceIdentifier-Input' + 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-Input' + 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 + 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: + 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-Output' + - 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-Output' + 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-Output' + - type: string + - type: boolean + type: array + title: Orderby + type: array + post_processing: + items: + anyOf: + - $ref: '#/components/schemas/SupersetPostProcessing-Output' + - 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-Output' + - 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 + QueryObjectExtras: + properties: + having: + default: '' + title: Having + type: string + time_grain_sqla: + anyOf: + - $ref: '#/components/schemas/TimeGrain' + - type: 'null' + where: + default: '' + title: Where + type: string + title: QueryObjectExtras + type: object + QueryObjectFilterClause: + properties: + col: + title: Col + type: string + grain: + anyOf: + - type: string + - type: 'null' + title: Grain + isExtra: + anyOf: + - type: boolean + - type: 'null' + title: Isextra + op: + $ref: '#/components/schemas/FilterOperator' + val: + anyOf: + - type: boolean + - description: Better annotation for datetime. Parses from string format, + serializes to string format. + format: date-time + type: string + - type: number + - type: integer + - type: string + - items: + anyOf: + - type: boolean + - description: Better annotation for datetime. Parses from string format, + serializes to string format. + format: date-time + type: string + - type: number + - type: integer + - type: string + type: array + - maxItems: 1 + minItems: 1 + prefixItems: + - anyOf: + - type: boolean + - description: Better annotation for datetime. Parses from string format, + serializes to string format. + format: date-time + type: string + - type: number + - type: integer + - type: string + type: array + - type: 'null' + title: Val + required: + - col + - op + title: QueryObjectFilterClause + type: object + SupersetAdhocColumn: + properties: + columnType: + default: BASE_AXIS + title: Columntype + type: string + expressionType: + default: SQL + title: Expressiontype + type: string + label: + title: Label + type: string + sqlExpression: + title: Sqlexpression + type: string + timeGrain: + anyOf: + - $ref: '#/components/schemas/TimeGrain' + - type: 'null' + required: + - label + - sqlExpression + title: SupersetAdhocColumn + type: object + SupersetAdhocFilter: + properties: + clause: + default: WHERE + title: Clause + type: string + comparator: + anyOf: + - type: string + - type: 'null' + default: No filter + title: Comparator + expressionType: + $ref: '#/components/schemas/ExpressionType' + default: SIMPLE + isExtra: + default: false + title: Isextra + type: boolean + isNew: + default: false + title: Isnew + type: boolean + operator: + $ref: '#/components/schemas/FilterOperator' + operatorId: + anyOf: + - $ref: '#/components/schemas/FilterStringOperators' + - type: 'null' + sqlExpression: + anyOf: + - type: string + - type: 'null' + title: Sqlexpression + subject: + title: Subject + type: string + required: + - subject + - operator + title: SupersetAdhocFilter + type: object + SupersetAdhocMetric-Input: + 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 + 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: + properties: + 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 + 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 + metadata: + $ref: '#/components/schemas/SupersetMetadataDef' + title: SupersetAssetsDef + type: object + SupersetChartDef-Input: + 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 + - type: 'null' + title: Description + external_url: + anyOf: + - description: Better annotation for AnyUrl. Parses from string format, + serializes to string format. + format: uri + minLength: 1 + type: string + - type: 'null' + title: External Url + is_managed_externally: + default: false + title: Is Managed Externally + 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 + - type: 'null' + title: Description + external_url: + anyOf: + - description: Better annotation for AnyUrl. Parses from string format, + serializes to string format. + format: uri + minLength: 1 + type: string + - 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 + 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 + SupersetColumn: + properties: + advanced_data_type: + anyOf: + - type: string + - type: 'null' + title: Advanced Data Type + column_name: + title: Column Name + type: string + description: + anyOf: + - type: string + - type: 'null' + title: Description + expression: + anyOf: + - type: string + - type: 'null' + title: Expression + extra: + title: Extra + type: object + filterable: + default: true + title: Filterable + type: boolean + groupby: + default: true + title: Groupby + type: boolean + id: + anyOf: + - type: integer + - type: 'null' + title: Id + is_active: + default: true + title: Is Active + type: boolean + is_dttm: + default: false + title: Is Dttm + type: boolean + python_date_format: + anyOf: + - type: string + - type: 'null' + title: Python Date Format + type: + default: VARCHAR + title: Type + type: string + type_generic: + $ref: '#/components/schemas/GenericDataType' + default: 1 + verbose_name: + anyOf: + - type: string + - type: 'null' + title: Verbose Name + required: + - column_name + title: SupersetColumn + type: object + SupersetDashboardDef: + properties: + certification_details: + anyOf: + - type: string + - type: 'null' + title: Certification Details + certified_by: + anyOf: + - type: string + - type: 'null' + title: Certified By + css: + anyOf: + - type: string + - type: 'null' + title: Css + dashboard_title: + title: Dashboard Title + type: string + description: + anyOf: + - type: string + - type: 'null' + title: Description + external_url: + anyOf: + - description: Better annotation for AnyUrl. Parses from string format, + serializes to string format. + format: uri + minLength: 1 + type: string + - type: 'null' + title: External Url + is_managed_externally: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Is Managed Externally + metadata: + title: Metadata + type: object + position: + title: Position + type: object + published: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Published + slug: + anyOf: + - type: string + - type: 'null' + title: Slug + 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: + - uuid + - dashboard_title + title: SupersetDashboardDef + type: object + SupersetDatabaseDef: + properties: + allow_ctas: + default: false + title: Allow Ctas + type: boolean + allow_cvas: + default: false + title: Allow Cvas + type: boolean + allow_dml: + default: false + title: Allow Dml + type: boolean + allow_file_upload: + default: false + title: Allow File Upload + type: boolean + allow_run_async: + default: false + title: Allow Run Async + type: boolean + cache_timeout: + anyOf: + - type: string + - type: 'null' + title: Cache Timeout + database_name: + title: Database Name + type: string + expose_in_sqllab: + default: true + title: Expose In Sqllab + type: boolean + extra: + title: Extra + type: object + impersonate_user: + default: false + title: Impersonate User + type: boolean + sqlalchemy_uri: + description: Better annotation for AnyUrl. Parses from string format, serializes + to string format. + format: uri + minLength: 1 + title: Sqlalchemy Uri + type: string + ssh_tunnel: + title: Ssh Tunnel + type: 'null' + 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: + - database_name + - sqlalchemy_uri + - 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: + 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 + 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: + properties: + database: + $ref: '#/components/schemas/SupersetDatabaseDef' + datasets: + items: + $ref: '#/components/schemas/SupersetDatasetDef-Output' + title: Datasets + type: array + required: + - database + title: SupersetDatasourceBundle + type: object + SupersetMetadataDef: + properties: + timestamp: + description: Better annotation for datetime. Parses from string format, + serializes to string format. + format: date-time + title: Timestamp + type: string + type: + $ref: '#/components/schemas/MetadataType' + default: SqlaTable + version: + default: 1.0.0 + title: Version + type: string + title: SupersetMetadataDef + type: object + SupersetMetric: + properties: + currency: + anyOf: + - type: string + - type: 'null' + title: Currency + d3format: + anyOf: + - type: string + - type: 'null' + title: D3Format + description: + anyOf: + - type: string + - type: 'null' + title: Description + expression: + title: Expression + type: string + extra: + title: Extra + type: object + metric_name: + title: Metric Name + type: string + metric_type: + anyOf: + - type: string + - type: 'null' + title: Metric Type + verbose_name: + title: Verbose Name + type: string + warning_text: + anyOf: + - type: string + - type: 'null' + title: Warning Text + required: + - metric_name + - verbose_name + - 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: + properties: + datasource_bundle: + $ref: '#/components/schemas/SupersetDatasourceBundle-Output' + mitm_dataset: + $ref: '#/components/schemas/SupersetMitMDatasetDef' + visualization_bundle: + $ref: '#/components/schemas/SupersetVisualizationBundle-Output' + required: + - mitm_dataset + - datasource_bundle + title: SupersetMitMDatasetBundle + type: object + SupersetMitMDatasetDef: + properties: + database_uuid: + description: Better annotation for UUID. Parses from string format, serializes + to string format. + format: uuid + title: Database Uuid + type: string + dataset_name: + title: Dataset Name + type: string + mitm: + $ref: '#/components/schemas/MITM' + 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: + - uuid + - dataset_name + - mitm + - database_uuid + title: SupersetMitMDatasetDef + type: object + SupersetPostProcessing-Input: + properties: {} + title: SupersetPostProcessing + type: object + SupersetPostProcessing-Output: + properties: + operation: + readOnly: true + title: Operation + type: string + required: + - operation + title: SupersetPostProcessing + type: object + SupersetVisualizationBundle-Input: + 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' + title: Charts + type: array + dashboards: + items: + $ref: '#/components/schemas/SupersetDashboardDef' + title: Dashboards + type: array + title: SupersetVisualizationBundle + type: object + SupersetVizType: + enum: + - pie + - echarts_timeseries_bar + - echarts_timeseries_line + title: SupersetVizType + type: string + TimeGrain: + 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 + type: string + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + title: Location + type: array + msg: + title: Message + type: string + type: + title: Error Type + type: string + required: + - loc + - msg + - type + title: ValidationError + type: object +info: + title: SupersetMitMService + version: 0.1.0 +openapi: 3.1.0 +paths: + /: + get: + operationId: root__get + responses: + '200': + content: + application/json: + schema: {} + description: Successful Response + summary: Root + /definitions/mitm_dataset: + post: + operationId: generate_mitm_dataset_def + parameters: + - in: query + name: dataset_name + required: true + schema: + title: Dataset Name + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Header' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MitMDatasetImportResponse' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Mitm Dataset Def + tags: + - definitions + /definitions/mitm_viz: + post: + 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': + content: + application/json: + schema: + $ref: '#/components/schemas/MitMVisualizationResponse' + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Generate Mitm Viz Def + tags: + - definitions + /upload/mitm_dataset: + post: + operationId: upload_mitm_dataset + parameters: + - in: query + name: dataset_identifier + required: true + schema: + title: Dataset Identifier + type: string + - in: query + name: mitm + required: false + schema: + $ref: '#/components/schemas/MITM' + default: MAED + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/Body_upload_mitm_dataset_upload_mitm_dataset_post' + required: true + responses: + '200': + content: + application/json: + schema: {} + description: Successful Response + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Upload Mitm Dataset + tags: + - upload + /upload/mitm_datasets: + get: + operationId: get_mitm_datasets + responses: + '200': + content: + application/json: + schema: {} + description: Successful Response + summary: Get Mitm Datasets + tags: + - upload diff --git a/superset/external_service_apis/mitm/schema.py b/superset/external_service_apis/mitm/schema.py new file mode 100644 index 0000000000000000000000000000000000000000..1155acd533b7a94a1d94353a6d2a0bc99c0ad508 --- /dev/null +++ b/superset/external_service_apis/mitm/schema.py @@ -0,0 +1,680 @@ +# generated by datamodel-codegen: +# filename: openapi.yaml +# timestamp: 2025-02-27T08:00:10+00:00 + +from __future__ import annotations + +from datetime import datetime +from enum import Enum +from typing import Any +from uuid import UUID + +from pydantic import AnyUrl, BaseModel, Field + + +class AnnotationOverrides(BaseModel): + time_range: str | None = Field(None, title='Time Range') + + +class AnnotationSource(str, Enum): + LINE = 'line' + NATIVE = 'NATIVE' + TABLE = 'table' + FIELD_ = '' + + +class AnnotationType(str, Enum): + EVENT = 'EVENT' + FORMULA = 'FORMULA' + INTERVAL = 'INTERVAL' + TIME_SERIES = 'TIME_SERIES' + + +class BodyUploadMitmDatasetUploadMitmDatasetPost(BaseModel): + mitm_zip: bytes = Field(..., title='Mitm Zip') + + +class ChartDataResultFormat(str, Enum): + CSV = 'csv' + JSON = 'json' + XLSX = 'xlsx' + + +class ChartDataResultType(str, Enum): + COLUMNS = 'columns' + FULL = 'full' + QUERY = 'query' + RESULTS = 'results' + SAMPLES = 'samples' + TIMEGRAINS = 'timegrains' + POST_PROCESSED = 'post_processed' + DRILL_DETAIL = 'drill_detail' + + +class ColorScheme(str, Enum): + BLUE_TO_GREEN = 'blueToGreen' + SUPERSET_COLORS = 'supersetColors' + + +class Type(str, Enum): + TABLE = 'table' + ANNOTATION = 'annotation' + + +class DatasourceIdentifierInput(BaseModel): + dataset_uuid: UUID = Field(..., title='Dataset Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + id: int | None = Field('placeholder', title='Id') + type: Type | None = Field('table', title='Type') + + +class DatasourceIdentifierOutput(BaseModel): + id: int | None = Field('placeholder', title='Id') + type: Type | None = Field('table', title='Type') + + +class ExpressionType(str, Enum): + SIMPLE = 'SIMPLE' + SQL = 'SQL' + + +class FilterOperator(str, Enum): + FIELD__ = '==' + field___1 = '!=' + FIELD_ = '>' + field__1 = '<' + field___2 = '>=' + field___3 = '<=' + LIKE = 'LIKE' + NOT_LIKE = 'NOT LIKE' + ILIKE = 'ILIKE' + IS_NULL = 'IS NULL' + IS_NOT_NULL = 'IS NOT NULL' + IN_ = 'IN' + NOT_IN = 'NOT IN' + IS_TRUE = 'IS TRUE' + IS_FALSE = 'IS FALSE' + TEMPORAL_RANGE = 'TEMPORAL_RANGE' + + +class FilterStringOperators(str, Enum): + EQUALS = 'EQUALS' + NOT_EQUALS = 'NOT_EQUALS' + LESS_THAN = 'LESS_THAN' + GREATER_THAN = 'GREATER_THAN' + LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL' + GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL' + IN_ = 'IN' + NOT_IN = 'NOT_IN' + ILIKE = 'ILIKE' + LIKE = 'LIKE' + IS_NOT_NULL = 'IS_NOT_NULL' + IS_NULL = 'IS_NULL' + LATEST_PARTITION = 'LATEST_PARTITION' + IS_TRUE = 'IS_TRUE' + IS_FALSE = 'IS_FALSE' + + +class FormData(BaseModel): + pass + + +class GenericDataType(int, Enum): + INTEGER_0 = 0 + INTEGER_1 = 1 + INTEGER_2 = 2 + INTEGER_3 = 3 + + +class MITM(str, Enum): + MAED = 'MAED' + OCEL2 = 'OCEL2' + + +class MITMDataType(str, Enum): + TEXT = 'text' + JSON = 'json' + INTEGER = 'integer' + NUMERIC = 'numeric' + BOOLEAN = 'boolean' + DATETIME = 'datetime' + UNKNOWN = 'unknown' + INFER = 'infer' + + +class MetadataType(str, Enum): + DATABASE = 'Database' + SQLA_TABLE = 'SqlaTable' + SLICE = 'Slice' + CHART = 'Chart' + DASHBOARD = 'Dashboard' + ASSET = 'Asset' + MIT_M_DATASET = 'MitMDataset' + + +class QueryObjectFilterClause(BaseModel): + col: str = Field(..., title='Col') + grain: str | None = Field(None, title='Grain') + isExtra: bool | None = Field(None, title='Isextra') + op: FilterOperator + val: ( + bool + | datetime + | float + | int + | str + | list[bool | datetime | float | int | str] + | list + | None + ) = Field(None, title='Val') + + +class SupersetAdhocFilter(BaseModel): + clause: str | None = Field('WHERE', title='Clause') + comparator: str | None = Field('No filter', title='Comparator') + expressionType: ExpressionType | None = 'SIMPLE' + isExtra: bool | None = Field(False, title='Isextra') + isNew: bool | None = Field(False, title='Isnew') + operator: FilterOperator + operatorId: FilterStringOperators | None = None + sqlExpression: str | None = Field(None, title='Sqlexpression') + subject: str = Field(..., title='Subject') + + +class SupersetAggregate(str, Enum): + COUNT = 'COUNT' + SUM = 'SUM' + MIN = 'MIN' + MAX = 'MAX' + AVG = 'AVG' + + +class SupersetColumn(BaseModel): + advanced_data_type: str | None = Field(None, title='Advanced Data Type') + column_name: str = Field(..., title='Column Name') + description: str | None = Field(None, title='Description') + expression: str | None = Field(None, title='Expression') + extra: dict[str, Any] | None = Field(None, title='Extra') + filterable: bool | None = Field(True, title='Filterable') + groupby: bool | None = Field(True, title='Groupby') + id: int | None = Field(None, title='Id') + is_active: bool | None = Field(True, title='Is Active') + is_dttm: bool | None = Field(False, title='Is Dttm') + python_date_format: str | None = Field(None, title='Python Date Format') + type: str | None = Field('VARCHAR', title='Type') + type_generic: GenericDataType | None = 1 + verbose_name: str | None = Field(None, title='Verbose Name') + + +class SupersetDashboardDef(BaseModel): + certification_details: str | None = Field(None, title='Certification Details') + certified_by: str | None = Field(None, title='Certified By') + css: str | None = Field(None, title='Css') + dashboard_title: str = Field(..., title='Dashboard Title') + description: str | None = Field(None, title='Description') + external_url: AnyUrl | None = Field(None, title='External Url') + is_managed_externally: bool | None = Field(False, title='Is Managed Externally') + metadata: dict[str, Any] | None = Field(None, title='Metadata') + position: dict[str, Any] | None = Field(None, title='Position') + published: bool | None = Field(False, title='Published') + slug: str | None = Field(None, title='Slug') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + + +class SupersetDatabaseDef(BaseModel): + allow_ctas: bool | None = Field(False, title='Allow Ctas') + allow_cvas: bool | None = Field(False, title='Allow Cvas') + allow_dml: bool | None = Field(False, title='Allow Dml') + allow_file_upload: bool | None = Field(False, title='Allow File Upload') + allow_run_async: bool | None = Field(False, title='Allow Run Async') + cache_timeout: str | None = Field(None, title='Cache Timeout') + database_name: str = Field(..., title='Database Name') + expose_in_sqllab: bool | None = Field(True, title='Expose In Sqllab') + extra: dict[str, Any] | None = Field(None, title='Extra') + impersonate_user: bool | None = Field(False, title='Impersonate User') + sqlalchemy_uri: AnyUrl = Field(..., title='Sqlalchemy Uri') + """ + Better annotation for AnyUrl. Parses from string format, serializes to string format. + """ + ssh_tunnel: None = Field(None, title='Ssh Tunnel') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + + +class SupersetMetadataDef(BaseModel): + timestamp: datetime | None = Field(None, title='Timestamp') + """ + Better annotation for datetime. Parses from string format, serializes to string format. + """ + type: MetadataType | None = 'SqlaTable' + version: str | None = Field('1.0.0', title='Version') + + +class SupersetMetric(BaseModel): + currency: str | None = Field(None, title='Currency') + d3format: str | None = Field(None, title='D3Format') + description: str | None = Field(None, title='Description') + expression: str = Field(..., title='Expression') + extra: dict[str, Any] | None = Field(None, title='Extra') + metric_name: str = Field(..., title='Metric Name') + metric_type: str | None = Field(None, title='Metric Type') + verbose_name: str = Field(..., title='Verbose Name') + warning_text: str | None = Field(None, title='Warning Text') + + +class SupersetMitMDatasetDef(BaseModel): + database_uuid: UUID = Field(..., title='Database Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + dataset_name: str = Field(..., title='Dataset Name') + mitm: MITM + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + + +class SupersetPostProcessingInput(BaseModel): + pass + + +class SupersetPostProcessingOutput(BaseModel): + operation: str = Field(..., title='Operation') + + +class SupersetVizType(str, Enum): + PIE = 'pie' + ECHARTS_TIMESERIES_BAR = 'echarts_timeseries_bar' + ECHARTS_TIMESERIES_LINE = 'echarts_timeseries_line' + + +class TimeGrain(str, Enum): + PT1_S = 'PT1S' + PT5_S = 'PT5S' + PT30_S = 'PT30S' + PT1_M = 'PT1M' + PT5_M = 'PT5M' + PT10_M = 'PT10M' + PT15_M = 'PT15M' + PT30_M = 'PT30M' + PT0_5_H = 'PT0.5H' + PT1_H = 'PT1H' + PT6_H = 'PT6H' + P1_D = 'P1D' + P1_W = 'P1W' + FIELD_1969_12_28_T00_00_00_Z_P1_W = '1969-12-28T00:00:00Z/P1W' + FIELD_1969_12_29_T00_00_00_Z_P1_W = '1969-12-29T00:00:00Z/P1W' + P1_W_1970_01_03_T00_00_00_Z = 'P1W/1970-01-03T00:00:00Z' + P1_W_1970_01_04_T00_00_00_Z = 'P1W/1970-01-04T00:00:00Z' + P1_M = 'P1M' + P3_M = 'P3M' + P0_25_Y = 'P0.25Y' + P1_Y = 'P1Y' + + +class ValidationError(BaseModel): + loc: list[str | int] = Field(..., title='Location') + msg: str = Field(..., title='Message') + type: str = Field(..., title='Error Type') + + +class AnnotationLayer(BaseModel): + annotationType: AnnotationType + hideLine: bool | None = Field(False, title='Hideline') + name: str = Field(..., title='Name') + opacity: str | None = Field('', title='Opacity') + overrides: AnnotationOverrides + show: bool | None = Field(False, title='Show') + showLabel: bool | None = Field(False, title='Showlabel') + showMarkers: bool | None = Field(False, title='Showmarkers') + sourceType: AnnotationSource | None = 'table' + style: str | None = Field('solid', title='Style') + value: int = Field(..., title='Value') + width: int | None = Field(1, title='Width') + + +class ChartParamsInput(BaseModel): + adhoc_filters: list[SupersetAdhocFilter] | None = Field(None, title='Adhoc Filters') + color_scheme: ColorScheme | None = Field('supersetColors', title='Color Scheme') + dashboards: list[int] | None = Field(None, title='Dashboards') + datasource: str | DatasourceIdentifierInput = Field(..., title='Datasource') + extra_form_data: dict[str, Any] | None = Field(None, title='Extra Form Data') + groupby: list[str] | None = Field(None, title='Groupby') + legendOrientation: str | None = Field('top', title='Legendorientation') + legendType: str | None = Field('scroll', title='Legendtype') + row_limit: int | None = Field(10000, title='Row Limit') + show_legend: bool | None = Field(True, title='Show Legend') + slice_id: int | None = Field(None, title='Slice Id') + sort_by_metric: bool | None = Field(True, title='Sort By Metric') + viz_type: SupersetVizType + + +class ChartParamsOutput(BaseModel): + adhoc_filters: list[SupersetAdhocFilter] | None = Field(None, title='Adhoc Filters') + color_scheme: ColorScheme | None = Field('supersetColors', title='Color Scheme') + dashboards: list[int] | None = Field(None, title='Dashboards') + datasource: str | DatasourceIdentifierOutput = Field(..., title='Datasource') + extra_form_data: dict[str, Any] | None = Field(None, title='Extra Form Data') + groupby: list[str] | None = Field(None, title='Groupby') + legendOrientation: str | None = Field('top', title='Legendorientation') + legendType: str | None = Field('scroll', title='Legendtype') + row_limit: int | None = Field(10000, title='Row Limit') + show_legend: bool | None = Field(True, title='Show Legend') + slice_id: int | None = Field(None, title='Slice Id') + sort_by_metric: bool | None = Field(True, title='Sort By Metric') + viz_type: SupersetVizType + + +class HTTPValidationError(BaseModel): + detail: list[ValidationError] | None = Field(None, title='Detail') + + +class HeaderEntry(BaseModel): + attribute_dtypes: list[MITMDataType] = Field(..., title='Attribute Dtypes') + attributes: list[str] = Field(..., title='Attributes') + concept: str = Field(..., title='Concept') + kind: str = Field(..., title='Kind') + type_name: str = Field(..., title='Type Name') + + +class QueryObjectExtras(BaseModel): + having: str | None = Field('', title='Having') + time_grain_sqla: TimeGrain | None = None + where: str | None = Field('', title='Where') + + +class SupersetAdhocColumn(BaseModel): + columnType: str | None = Field('BASE_AXIS', title='Columntype') + expressionType: str | None = Field('SQL', title='Expressiontype') + label: str = Field(..., title='Label') + sqlExpression: str = Field(..., title='Sqlexpression') + timeGrain: TimeGrain | None = None + + +class SupersetAdhocMetricInput(BaseModel): + aggregate: SupersetAggregate | None = 'COUNT' + column: SupersetColumn + datasourceWarning: bool | None = Field(False, title='Datasourcewarning') + expressionType: ExpressionType | None = 'SIMPLE' + hasCustomLabel: bool | None = Field(False, title='Hascustomlabel') + label: str = Field(..., title='Label') + optionName: str | None = Field(None, title='Optionname') + sqlExpression: str | None = Field(None, title='Sqlexpression') + + +class SupersetAdhocMetricOutput(BaseModel): + aggregate: SupersetAggregate | None = 'COUNT' + column: SupersetColumn + datasourceWarning: bool | None = Field(False, title='Datasourcewarning') + expressionType: ExpressionType | None = 'SIMPLE' + hasCustomLabel: bool | None = Field(False, title='Hascustomlabel') + label: str = Field(..., title='Label') + optionName: str | None = Field(None, title='Optionname') + sqlExpression: str | None = Field(None, title='Sqlexpression') + + +class SupersetChartDefOutput(BaseModel): + cache_timeout: int | None = Field(None, title='Cache Timeout') + certification_details: str | None = Field(None, title='Certification Details') + certified_by: str | None = Field(None, title='Certified By') + dataset_uuid: UUID = Field(..., title='Dataset Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + description: str | None = Field(None, title='Description') + external_url: AnyUrl | None = Field(None, title='External Url') + is_managed_externally: bool | None = Field(False, title='Is Managed Externally') + params: ChartParamsOutput | dict[str, Any] | None = Field(None, title='Params') + query_context: Any | None = Field(None, title='Query Context') + slice_name: str = Field(..., title='Slice Name') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + viz_type: SupersetVizType + + +class SupersetDatasetDefInput(BaseModel): + always_filter_main_dttm: bool | None = Field(False, title='Always Filter Main Dttm') + cache_timeout: str | None = Field(None, title='Cache Timeout') + catalog: str | None = Field(None, title='Catalog') + columns: list[SupersetColumn] | None = Field(None, title='Columns') + database_uuid: UUID = Field(..., title='Database Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + default_endpoint: str | None = Field(None, title='Default Endpoint') + description: str | None = Field(None, title='Description') + extra: dict[str, Any] | None = Field(None, title='Extra') + fetch_values_predicate: str | None = Field(None, title='Fetch Values Predicate') + filter_select_enabled: bool | None = Field(True, title='Filter Select Enabled') + main_dttm_col: str | None = Field(None, title='Main Dttm Col') + metrics: list[SupersetMetric] | None = Field(None, title='Metrics') + normalize_columns: bool | None = Field(False, title='Normalize Columns') + offset: int | None = Field(0, title='Offset') + params: Any | None = Field(None, title='Params') + schema_: str = Field(..., alias='schema', title='Schema') + sql: str | None = Field(None, title='Sql') + table_name: str = Field(..., title='Table Name') + template_params: Any | None = Field(None, title='Template Params') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + + +class SupersetDatasetDefOutput(BaseModel): + always_filter_main_dttm: bool | None = Field(False, title='Always Filter Main Dttm') + cache_timeout: str | None = Field(None, title='Cache Timeout') + catalog: str | None = Field(None, title='Catalog') + columns: list[SupersetColumn] | None = Field(None, title='Columns') + database_uuid: UUID = Field(..., title='Database Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + default_endpoint: str | None = Field(None, title='Default Endpoint') + description: str | None = Field(None, title='Description') + extra: dict[str, Any] | None = Field(None, title='Extra') + fetch_values_predicate: str | None = Field(None, title='Fetch Values Predicate') + filter_select_enabled: bool | None = Field(True, title='Filter Select Enabled') + main_dttm_col: str | None = Field(None, title='Main Dttm Col') + metrics: list[SupersetMetric] | None = Field(None, title='Metrics') + normalize_columns: bool | None = Field(False, title='Normalize Columns') + offset: int | None = Field(0, title='Offset') + params: Any | None = Field(None, title='Params') + schema_: str = Field(..., alias='schema', title='Schema') + sql: str | None = Field(None, title='Sql') + table_name: str = Field(..., title='Table Name') + template_params: Any | None = Field(None, title='Template Params') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + + +class SupersetDatasourceBundleInput(BaseModel): + database: SupersetDatabaseDef + datasets: list[SupersetDatasetDefInput] | None = Field(None, title='Datasets') + + +class SupersetDatasourceBundleOutput(BaseModel): + database: SupersetDatabaseDef + datasets: list[SupersetDatasetDefOutput] | None = Field(None, title='Datasets') + + +class SupersetVisualizationBundleOutput(BaseModel): + charts: list[SupersetChartDefOutput] | None = Field(None, title='Charts') + dashboards: list[SupersetDashboardDef] | None = Field(None, title='Dashboards') + + +class Header(BaseModel): + header_entries: list[HeaderEntry] | None = Field(None, title='Header Entries') + mitm: MITM + + +class QueryObjectInput(BaseModel): + annotation_layers: list[AnnotationLayer] | None = Field( + None, title='Annotation Layers' + ) + applied_time_extras: dict[str, str] | None = Field( + None, title='Applied Time Extras' + ) + columns: list[str | SupersetAdhocColumn] | None = Field(None, title='Columns') + datasource: DatasourceIdentifierInput | None = None + extras: QueryObjectExtras | None = None + filters: list[QueryObjectFilterClause] | None = Field(None, title='Filters') + from_dttm: datetime | None = Field(None, title='From Dttm') + granularity: str | None = Field(None, title='Granularity') + inner_from_dttm: datetime | None = Field(None, title='Inner From Dttm') + inner_to_dttm: datetime | None = Field(None, title='Inner To Dttm') + is_rowcount: bool | None = Field(False, title='Is Rowcount') + is_timeseries: bool | None = Field(None, title='Is Timeseries') + metrics: list[SupersetAdhocMetricInput] | None = Field(None, title='Metrics') + order_desc: bool | None = Field(True, title='Order Desc') + orderby: list[list] | None = Field(None, title='Orderby') + post_processing: list[SupersetPostProcessingInput | dict[str, Any]] | None = Field( + None, title='Post Processing' + ) + result_type: ChartDataResultType | None = None + row_limit: int | None = Field(None, title='Row Limit') + row_offset: int | None = Field(None, title='Row Offset') + series_columns: list[str] | None = Field(None, title='Series Columns') + series_limit: int | None = Field(0, title='Series Limit') + series_limit_metric: SupersetAdhocMetricInput | None = None + time_offsets: list[str] | None = Field(None, title='Time Offsets') + time_range: str | None = Field(None, title='Time Range') + time_shift: str | None = Field(None, title='Time Shift') + to_dttm: datetime | None = Field(None, title='To Dttm') + url_params: dict[str, str] | None = Field(None, title='Url Params') + + +class QueryObjectOutput(BaseModel): + annotation_layers: list[AnnotationLayer] | None = Field( + None, title='Annotation Layers' + ) + applied_time_extras: dict[str, str] | None = Field( + None, title='Applied Time Extras' + ) + columns: list[str | SupersetAdhocColumn] | None = Field(None, title='Columns') + datasource: DatasourceIdentifierOutput | None = None + extras: QueryObjectExtras | None = None + filters: list[QueryObjectFilterClause] | None = Field(None, title='Filters') + from_dttm: datetime | None = Field(None, title='From Dttm') + granularity: str | None = Field(None, title='Granularity') + inner_from_dttm: datetime | None = Field(None, title='Inner From Dttm') + inner_to_dttm: datetime | None = Field(None, title='Inner To Dttm') + is_rowcount: bool | None = Field(False, title='Is Rowcount') + is_timeseries: bool | None = Field(None, title='Is Timeseries') + metrics: list[SupersetAdhocMetricOutput] | None = Field(None, title='Metrics') + order_desc: bool | None = Field(True, title='Order Desc') + orderby: list[list] | None = Field(None, title='Orderby') + post_processing: list[SupersetPostProcessingOutput | dict[str, Any]] | None = Field( + None, title='Post Processing' + ) + result_type: ChartDataResultType | None = None + row_limit: int | None = Field(None, title='Row Limit') + row_offset: int | None = Field(None, title='Row Offset') + series_columns: list[str] | None = Field(None, title='Series Columns') + series_limit: int | None = Field(0, title='Series Limit') + series_limit_metric: SupersetAdhocMetricOutput | None = None + time_offsets: list[str] | None = Field(None, title='Time Offsets') + time_range: str | None = Field(None, title='Time Range') + time_shift: str | None = Field(None, title='Time Shift') + to_dttm: datetime | None = Field(None, title='To Dttm') + url_params: dict[str, str] | None = Field(None, title='Url Params') + + +class SupersetAssetsDef(BaseModel): + charts: list[SupersetChartDefOutput] | None = Field(None, title='Charts') + dashboards: list[SupersetDashboardDef] | None = Field(None, title='Dashboards') + databases: list[SupersetDatabaseDef] | None = Field(None, title='Databases') + datasets: list[SupersetDatasetDefOutput] | None = Field(None, title='Datasets') + metadata: SupersetMetadataDef | None = None + + +class SupersetMitMDatasetBundleOutput(BaseModel): + datasource_bundle: SupersetDatasourceBundleOutput + mitm_dataset: SupersetMitMDatasetDef + visualization_bundle: SupersetVisualizationBundleOutput | None = None + + +class MitMDatasetImportResponse(BaseModel): + base_assets: SupersetAssetsDef + definition_bundle: SupersetMitMDatasetBundleOutput + + +class MitMVisualizationResponse(BaseModel): + base_assets: SupersetAssetsDef + definition_bundle: SupersetMitMDatasetBundleOutput + + +class QueryContextInput(BaseModel): + custom_cache_timeout: int | None = Field(None, title='Custom Cache Timeout') + datasource: DatasourceIdentifierInput + force: bool | None = Field(False, title='Force') + form_data: FormData | dict[str, Any] | None = Field(None, title='Form Data') + queries: list[QueryObjectInput] | None = Field(None, title='Queries') + result_format: ChartDataResultFormat | None = 'json' + result_type: ChartDataResultType | None = 'full' + + +class QueryContextOutput(BaseModel): + custom_cache_timeout: int | None = Field(None, title='Custom Cache Timeout') + datasource: DatasourceIdentifierOutput + force: bool | None = Field(False, title='Force') + form_data: FormData | dict[str, Any] | None = Field(None, title='Form Data') + queries: list[QueryObjectOutput] | None = Field(None, title='Queries') + result_format: ChartDataResultFormat | None = 'json' + result_type: ChartDataResultType | None = 'full' + + +class SupersetChartDefInput(BaseModel): + cache_timeout: int | None = Field(None, title='Cache Timeout') + certification_details: str | None = Field(None, title='Certification Details') + certified_by: str | None = Field(None, title='Certified By') + dataset_uuid: UUID = Field(..., title='Dataset Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + description: str | None = Field(None, title='Description') + external_url: AnyUrl | None = Field(None, title='External Url') + is_managed_externally: bool | None = Field(False, title='Is Managed Externally') + params: ChartParamsInput | dict[str, Any] | None = Field(None, title='Params') + query_context: str | QueryContextInput | None = Field(None, title='Query Context') + slice_name: str = Field(..., title='Slice Name') + uuid: UUID = Field(..., title='Uuid') + """ + Better annotation for UUID. Parses from string format, serializes to string format. + """ + version: str | None = Field('1.0.0', title='Version') + viz_type: SupersetVizType + + +class SupersetVisualizationBundleInput(BaseModel): + charts: list[SupersetChartDefInput] | None = Field(None, title='Charts') + dashboards: list[SupersetDashboardDef] | None = Field(None, title='Dashboards') + + +class SupersetMitMDatasetBundleInput(BaseModel): + datasource_bundle: SupersetDatasourceBundleInput + mitm_dataset: SupersetMitMDatasetDef + visualization_bundle: SupersetVisualizationBundleInput | None = None + + +class BodyGenerateMitmVizDefDefinitionsMitmVizPost(BaseModel): + header: Header + mitm_dataset_bundle: SupersetMitMDatasetBundleInput diff --git a/superset/initialization/__init__.py b/superset/initialization/__init__.py index 08e655c0e94e1a6eb856e0b687df6d22b57d9f03..b7f76d0d9bb37ace58f82d6595aa4c5a4cfa88fb 100644 --- a/superset/initialization/__init__.py +++ b/superset/initialization/__init__.py @@ -723,7 +723,8 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods # NEW def configure_api_forwarding(self) -> None: - external_service_call_manager_factory.init_app(self.superset_app) + if feature_flag_manager.is_feature_enabled("MITM_SUPPORT"): + external_service_call_manager_factory.init_app(self.superset_app) class SupersetIndexView(IndexView): diff --git a/superset/models/mitm.py b/superset/models/mitm.py index 6d7fa994ab2a3243d37cb44bfae3af65cb553055..01d433ccb0ce54afb12c81c649bf20b452bd7c83 100644 --- a/superset/models/mitm.py +++ b/superset/models/mitm.py @@ -1,57 +1,49 @@ from __future__ import annotations -import builtins -import logging -import textwrap -from ast import literal_eval -from contextlib import closing, contextmanager, nullcontext, suppress -from copy import deepcopy -from datetime import datetime -from functools import lru_cache -from inspect import signature -from typing import Any, Callable, cast, TYPE_CHECKING - -import numpy -import pandas as pd -import sqlalchemy as sqla -import sshtunnel -from flask import g, request +import sqlalchemy as sa from flask_appbuilder import Model from sqlalchemy import ( - Boolean, Column, - create_engine, - DateTime, ForeignKey, Integer, - MetaData, String, - Table as SqlaTable, - Text, ) -from sqlalchemy.engine import Connection, Dialect, Engine -from sqlalchemy.engine.reflection import Inspector -from sqlalchemy.engine.url import URL -from sqlalchemy.exc import NoSuchModuleError -from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.orm import relationship -from sqlalchemy.pool import NullPool from sqlalchemy.schema import UniqueConstraint -from sqlalchemy.sql import ColumnElement, expression, Select -from superset import app, db, db_engine_specs, is_feature_enabled -from superset.commands.database.exceptions import DatabaseInvalidError -from superset.constants import LRU_CACHE_MAX_SIZE, PASSWORD_MASK -from superset.databases.utils import make_url_safe -from superset.db_engine_specs.base import MetricType, TimeGrain -from superset.extensions import ( - cache_manager, - encrypted_field_factory, - event_logger, - security_manager, - ssh_manager_factory, +from superset.models.helpers import AuditMixinNullable, ImportExportMixin + +metadata = Model.metadata # pylint: disable=no-member + +mitm_dataset_tables = sa.Table( + "mitm_dataset_tables", + metadata, + Column("id", Integer, primary_key=True), + Column("mitm_dataset_id", Integer, + ForeignKey("mitm_datasets.id", ondelete="CASCADE")), + Column("table_id", Integer, ForeignKey("tables.id", ondelete="CASCADE")), + UniqueConstraint("mitm_dataset_id", "table_id"), +) + +mitm_dataset_slices = sa.Table( + "mitm_dataset_slices", + metadata, + Column("id", Integer, primary_key=True), + Column("mitm_dataset_id", Integer, + ForeignKey("mitm_datasets.id", ondelete="CASCADE")), + Column("slice_id", Integer, ForeignKey("slices.id", ondelete="CASCADE")), + UniqueConstraint("mitm_dataset_id", "slice_id"), +) + +mitm_dataset_dashboards = sa.Table( + "mitm_dataset_dashboards", + metadata, + Column("id", Integer, primary_key=True), + Column("mitm_dataset_id", Integer, + ForeignKey("mitm_datasets.id", ondelete="CASCADE")), + Column("dashboard_id", Integer, ForeignKey("dashboards.id", ondelete="CASCADE")), + UniqueConstraint("mitm_dataset_id", "dashboard_id"), ) -from superset.models.helpers import AuditMixinNullable, ImportExportMixin, UUIDMixin class MitMDataset(Model, AuditMixinNullable, @@ -59,17 +51,20 @@ class MitMDataset(Model, AuditMixinNullable, """An ORM object that stores MitM Dataset related information""" __tablename__ = 'mitm_datasets' - type = 'table' id = Column(Integer, primary_key=True) dataset_name = Column(String(255), nullable=False) - mitm = Column(String(255), nullable=False) + mitm = Column(String(127), nullable=False) database_id = Column(Integer, ForeignKey('dbs.id', ondelete='CASCADE'), nullable=False) database = relationship('Database', foreign_keys=[database_id]) + tables = relationship('SqlaTable', secondary='mitm_dataset_tables') + slices = relationship('Slice', secondary='mitm_dataset_slices') + dashboards = relationship('Dashboard', secondary='mitm_dataset_dashboards') export_fields = ['id', 'dataset_name', 'mitm', 'database_id'] export_parent = ['database'] + export_children = ['tables', 'slices', 'dashboards'] @property def database_name(self) -> str: diff --git a/superset/service_call_manager.py b/superset/service_call_manager.py index dbae6b31d4f7ce2e607f5b71186552171720acaa..6058ad09153d7cbe4c559a72684fb37f8f6d3ecc 100644 --- a/superset/service_call_manager.py +++ b/superset/service_call_manager.py @@ -11,6 +11,7 @@ from celery.result import AsyncResult from flask import Request, Flask from werkzeug.datastructures import Headers +from superset import is_feature_enabled from superset.exceptions import CacheLoadError from superset.utils import json @@ -153,20 +154,20 @@ class ExternalServiceCallManager: self.update_job(job_metadata, status='error', errors=errors or []) def retrieve_job_result(self, cache_key: str) -> Any | None: - try: - return self.cache.get(cache_key) - except CacheLoadError as ex: - logger.error(f'Retrieval of job result failed: {ex.message}') - raise + if v := self.cache.get(cache_key): + return v + else: + logger.error(f'Retrieval of job result failed: {cache_key}') def retrieve_job_result_json(self, cache_key: str) -> str | int | float | \ dict[str, Any] | None: - v = self.retrieve_job_result(cache_key) - try: - return json.loads(v, encoding='utf-8') - except JSONDecodeError as ex: - logger.error(f'JSON decoding of retrieved job result failed: {ex.msg}') - raise + if v := self.cache.get(cache_key): + try: + if v is not None: + return json.loads(v, encoding='utf-8') + except JSONDecodeError as ex: + logger.error( + f'JSON decoding of job result failed: {cache_key} with {ex.msg}') class ExternalServiceCallManagerFactory: @@ -174,6 +175,7 @@ class ExternalServiceCallManagerFactory: self._external_service_call_manager: ExternalServiceCallManager = None # type: ignore def init_app(self, app: Flask) -> None: + is_feature_enabled self._external_service_call_manager = ExternalServiceCallManager() self._external_service_call_manager.init_app(app)