feat!: pass datasource_type and datasource_id to form_data (#19981)

* pass datasource_type and datasource_id to form_data

* add datasource_type to delete command

* add datasource_type to delete command

* fix old keys implementation

* add more tests
This commit is contained in:
Elizabeth Thompson
2022-06-02 16:48:16 -07:00
committed by GitHub
parent a813528958
commit 32bb1ce3ff
47 changed files with 959 additions and 176 deletions

View File

@@ -14,12 +14,20 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from marshmallow import fields, Schema
from marshmallow import fields, Schema, validate
from superset.utils.core import DatasourceType
class FormDataPostSchema(Schema):
dataset_id = fields.Integer(
required=True, allow_none=False, description="The dataset ID"
datasource_id = fields.Integer(
required=True, allow_none=False, description="The datasource ID"
)
datasource_type = fields.String(
required=True,
allow_none=False,
description="The datasource type",
validate=validate.OneOf(choices=[ds.value for ds in DatasourceType]),
)
chart_id = fields.Integer(required=False, description="The chart ID")
form_data = fields.String(
@@ -28,8 +36,14 @@ class FormDataPostSchema(Schema):
class FormDataPutSchema(Schema):
dataset_id = fields.Integer(
required=True, allow_none=False, description="The dataset ID"
datasource_id = fields.Integer(
required=True, allow_none=False, description="The datasource ID"
)
datasource_type = fields.String(
required=True,
allow_none=False,
description="The datasource type",
validate=validate.OneOf(choices=[ds.value for ds in DatasourceType]),
)
chart_id = fields.Integer(required=False, description="The chart ID")
form_data = fields.String(