feat(api): Add option to enable sync on import (#20312)
This commit is contained in:
parent
f42516887d
commit
a5ff0949a6
|
|
@ -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
|
||||
|
|
@ -3336,27 +3339,6 @@
|
|||
"type": "object"
|
||||
},
|
||||
"DashboardRestApi.get_list.User1": {
|
||||
"properties": {
|
||||
"first_name": {
|
||||
"maxLength": 64,
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
},
|
||||
"last_name": {
|
||||
"maxLength": 64,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"first_name",
|
||||
"last_name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"DashboardRestApi.get_list.User2": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"maxLength": 64,
|
||||
|
|
@ -3387,6 +3369,27 @@
|
|||
],
|
||||
"type": "object"
|
||||
},
|
||||
"DashboardRestApi.get_list.User2": {
|
||||
"properties": {
|
||||
"first_name": {
|
||||
"maxLength": 64,
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
},
|
||||
"last_name": {
|
||||
"maxLength": 64,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"first_name",
|
||||
"last_name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"DashboardRestApi.post": {
|
||||
"properties": {
|
||||
"certification_details": {
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -817,6 +817,12 @@ class DatasetRestApi(BaseSupersetModelRestApi):
|
|||
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 @@ class DatasetRestApi(BaseSupersetModelRestApi):
|
|||
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")
|
||||
|
|
|
|||
|
|
@ -1905,6 +1905,8 @@ class TestDatasetApi(SupersetTestCase):
|
|||
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 @@ class TestDatasetApi(SupersetTestCase):
|
|||
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"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue