Skip to content

Commit

Permalink
fix(dataset-api): allow undefined schema in post
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed May 29, 2023
1 parent 50535e4 commit 2373881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions superset/datasets/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DatasetMetricsPutSchema(Schema):

class DatasetPostSchema(Schema):
database = fields.Integer(required=True)
schema = fields.String(validate=Length(0, 250))
schema = fields.String(allow_none=True, validate=Length(0, 250))
table_name = fields.String(required=True, allow_none=False, validate=Length(1, 250))
sql = fields.String(allow_none=True)
owners = fields.List(fields.Integer())
Expand Down Expand Up @@ -236,7 +236,9 @@ class GetOrCreateDatasetSchema(Schema):
required=True, metadata={"description": "ID of database table belongs to"}
)
schema = fields.String(
metadata={"description": "The schema the table belongs to"}, allow_none=True
allow_none=True,
validate=Length(0, 250),
metadata={"description": "The schema the table belongs to"},
)
template_params = fields.String(
metadata={"description": "Template params for the table"}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/datasets/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def test_create_dataset_item(self):
self.login(username="admin")
table_data = {
"database": main_db.id,
"schema": "",
"schema": None,
"table_name": "ab_permission",
}
uri = "api/v1/dataset/"
Expand Down

0 comments on commit 2373881

Please sign in to comment.