diff --git a/docs/static/resources/openapi.json b/docs/static/resources/openapi.json index 580b87d15301..62153bac51cb 100644 --- a/docs/static/resources/openapi.json +++ b/docs/static/resources/openapi.json @@ -1710,7 +1710,7 @@ "$ref": "#/components/schemas/ChartDataRestApi.get_list.User2" }, "owners": { - "$ref": "#/components/schemas/ChartDataRestApi.get_list.User3" + "$ref": "#/components/schemas/ChartDataRestApi.get_list.User1" }, "params": { "nullable": true, @@ -1784,11 +1784,16 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -1826,16 +1831,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -2468,7 +2468,7 @@ "$ref": "#/components/schemas/ChartRestApi.get_list.User2" }, "owners": { - "$ref": "#/components/schemas/ChartRestApi.get_list.User3" + "$ref": "#/components/schemas/ChartRestApi.get_list.User1" }, "params": { "nullable": true, @@ -2542,11 +2542,16 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -2584,16 +2589,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -3237,7 +3237,10 @@ "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/DashboardRestApi.get_list.User1" + "$ref": "#/components/schemas/DashboardRestApi.get_list.User2" + }, + "created_on_delta_humanized": { + "readOnly": true }, "created_on_delta_humanized": { "readOnly": true @@ -3337,6 +3340,10 @@ }, "DashboardRestApi.get_list.User1": { "properties": { + "email": { + "maxLength": 64, + "type": "string" + }, "first_name": { "maxLength": 64, "type": "string" @@ -3348,20 +3355,22 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ + "email", "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, "DashboardRestApi.get_list.User2": { "properties": { - "email": { - "maxLength": 64, - "type": "string" - }, "first_name": { "maxLength": 64, "type": "string" @@ -3373,17 +3382,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ - "email", "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -3572,6 +3575,14 @@ }, "type": "object" }, + "Database1": { + "properties": { + "database_name": { + "type": "string" + } + }, + "type": "object" + }, "DatabaseFunctionNamesResponse": { "properties": { "function_names": { @@ -5103,6 +5114,80 @@ }, "type": "object" }, + "ExplorePermalinkPostSchema": { + "properties": { + "allowed_domains": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "allowed_domains" + ], + "type": "object" + }, + "EmbeddedDashboardResponseSchema": { + "properties": { + "allowed_domains": { + "items": { + "type": "string" + }, + "type": "array" + }, + "changed_by": { + "$ref": "#/components/schemas/User" + }, + "changed_on": { + "format": "date-time", + "type": "string" + }, + "dashboard_id": { + "type": "string" + }, + "uuid": { + "type": "string" + } + }, + "type": "object" + }, + "EmbeddedDashboardRestApi.get": { + "properties": { + "uuid": { + "format": "uuid", + "type": "string" + } + }, + "type": "object" + }, + "EmbeddedDashboardRestApi.get_list": { + "properties": { + "uuid": { + "format": "uuid", + "type": "string" + } + }, + "type": "object" + }, + "EmbeddedDashboardRestApi.post": { + "properties": { + "uuid": { + "format": "uuid", + "type": "string" + } + }, + "type": "object" + }, + "EmbeddedDashboardRestApi.put": { + "properties": { + "uuid": { + "format": "uuid", + "type": "string" + } + }, + "type": "object" + }, "ExplorePermalinkPostSchema": { "properties": { "formData": { @@ -6142,7 +6227,7 @@ "type": "integer" }, "created_by": { - "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User1" + "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User2" }, "created_on": { "format": "date-time", @@ -6189,7 +6274,7 @@ "type": "string" }, "owners": { - "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User2" + "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User1" }, "recipients": { "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.ReportRecipients" @@ -6250,6 +6335,10 @@ "maxLength": 64, "type": "string" }, + "id": { + "format": "int32", + "type": "integer" + }, "last_name": { "maxLength": 64, "type": "string" @@ -6267,10 +6356,6 @@ "maxLength": 64, "type": "string" }, - "id": { - "format": "int32", - "type": "integer" - }, "last_name": { "maxLength": 64, "type": "string" @@ -8682,6 +8767,99 @@ ] } }, + "/api/v1/annotation_layer/": { + "delete": { + "description": "Deletes multiple annotation layers in a bulk operation.", + "parameters": [ + { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/advanced_data_type_convert_schema" + } + } + }, + "in": "query", + "name": "q" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdvancedDataTypeSchema" + } + } + }, + "description": "AdvancedDataTypeResponse object has been returned." + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "500": { + "$ref": "#/components/responses/500" + } + }, + "security": [ + { + "jwt": [] + } + ], + "summary": "Returns a AdvancedDataTypeResponse object populated with the passed in args.", + "tags": [ + "Advanced Data Type" + ] + } + }, + "/api/v1/advanced_data_type/types": { + "get": { + "description": "Returns a list of available advanced data types.", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "result": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "a successful return of the available advanced data types has taken place." + }, + "401": { + "$ref": "#/components/responses/401" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "500": { + "$ref": "#/components/responses/500" + } + }, + "security": [ + { + "jwt": [] + } + ], + "tags": [ + "Advanced Data Type" + ] + } + }, "/api/v1/annotation_layer/": { "delete": { "description": "Deletes multiple annotation layers in a bulk operation.", @@ -14398,6 +14576,75 @@ ] } }, + "/api/v1/database/{pk}/select_star/{table_name}/{schema_name}/": { + "get": { + "description": "Get database select star for table", + "parameters": [ + { + "description": "The database id", + "in": "path", + "name": "pk", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "description": "Table name", + "in": "path", + "name": "table_name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Table schema", + "in": "path", + "name": "schema_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelectStarResponseSchema" + } + } + }, + "description": "SQL statement for a select star for table" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "422": { + "$ref": "#/components/responses/422" + }, + "500": { + "$ref": "#/components/responses/500" + } + }, + "security": [ + { + "jwt": [] + } + ], + "tags": [ + "Database" + ] + } + }, "/api/v1/database/{pk}/table/{table_name}/{schema_name}/": { "get": { "description": "Get database table metadata", @@ -15108,6 +15355,14 @@ "passwords": { "description": "JSON map of passwords for each featured database in the ZIP file. If the ZIP includes a database config in the path `databases/MyDatabase.yaml`, the password should be provided in the following format: `{\"databases/MyDatabase.yaml\": \"my_password\"}`.", "type": "string" + }, + "sync_columns": { + "description": "sync columns?", + "type": "boolean" + }, + "sync_metrics": { + "description": "sync metrics?", + "type": "boolean" } }, "type": "object" diff --git a/superset/datasets/api.py b/superset/datasets/api.py index be5ab7c430f7..276366c6b054 100644 --- a/superset/datasets/api.py +++ b/superset/datasets/api.py @@ -817,6 +817,12 @@ def import_(self) -> Response: overwrite: description: overwrite existing datasets? type: boolean + sync_columns: + description: sync columns? + type: boolean + sync_metrics: + description: sync metrics? + type: boolean responses: 200: description: Dataset import result @@ -855,9 +861,15 @@ def import_(self) -> Response: else None ) overwrite = request.form.get("overwrite") == "true" + sync_columns = request.form.get("sync_columns") == "true" + sync_metrics = request.form.get("sync_metrics") == "true" command = ImportDatasetsCommand( - contents, passwords=passwords, overwrite=overwrite + contents, + passwords=passwords, + overwrite=overwrite, + sync_columns=sync_columns, + sync_metrics=sync_metrics, ) command.run() return self.response(200, message="OK") diff --git a/tests/integration_tests/datasets/api_tests.py b/tests/integration_tests/datasets/api_tests.py index fa6ad266929f..2045a0fdcf38 100644 --- a/tests/integration_tests/datasets/api_tests.py +++ b/tests/integration_tests/datasets/api_tests.py @@ -1905,6 +1905,8 @@ def test_import_dataset(self): buf = self.create_dataset_import() form_data = { "formData": (buf, "dataset_export.zip"), + "sync_columns": "true", + "sync_metrics": "true", } rv = self.client.post(uri, data=form_data, content_type="multipart/form-data") response = json.loads(rv.data.decode("utf-8")) @@ -1947,6 +1949,8 @@ def test_import_dataset_v0_export(self): buf.seek(0) form_data = { "formData": (buf, "dataset_export.zip"), + "sync_columns": "true", + "sync_metrics": "true", } rv = self.client.post(uri, data=form_data, content_type="multipart/form-data") response = json.loads(rv.data.decode("utf-8"))