You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/04/18 07:19:31 UTC

[GitHub] [superset] villebro commented on a diff in pull request #23655: feat: add verbose map to get /dataset/ endpoint

villebro commented on code in PR #23655:
URL: https://github.com/apache/superset/pull/23655#discussion_r1169597164


##########
superset/datasets/schemas.py:
##########
@@ -145,6 +146,34 @@ class DatasetRelatedObjectsResponse(Schema):
     dashboards = fields.Nested(DatasetRelatedDashboards)
 
 
+class DatasetResponse(Schema):
+    id = fields.Int()
+    cache_timeout = fields.Int()
+    columns = fields.List(fields.Dict())

Review Comment:
   Setting this as `fields.List(fields.Dict())` causes it to lose the datatype. This is after this change:
   <img width="922" alt="image" src="https://user-images.githubusercontent.com/33317356/232698854-769e8dc0-a3f8-4fd5-bbc9-322cf2f94ced.png">
   
   This is before the change:
   <img width="919" alt="image" src="https://user-images.githubusercontent.com/33317356/232699232-dbaab196-9936-4196-921c-da0200eed33b.png">
   
   Here's a schema that I believe is more complete that could probably serve as a better template:
   https://github.com/apache/superset/blob/c197bf9e6db85a76d8118a4ec11a83ca2f6aad6d/superset/datasets/schemas.py#L47-L63



##########
superset/datasets/schemas.py:
##########
@@ -145,6 +146,34 @@ class DatasetRelatedObjectsResponse(Schema):
     dashboards = fields.Nested(DatasetRelatedDashboards)
 
 
+class DatasetResponse(Schema):
+    id = fields.Int()
+    cache_timeout = fields.Int()
+    columns = fields.List(fields.Dict())
+    database = fields.Nested(DatabaseSchema)
+    datasource_type = fields.String()
+    default_endpoint = fields.String()
+    description = fields.String()
+    extra = fields.String()
+    fetch_values_predicate = fields.String()
+    filter_select_enabled = fields.Bool()
+    is_managed_externally = fields.Bool()
+    is_sqllab_view = fields.Bool()
+    kind = fields.String()
+    main_dttm_col = fields.String()
+    metrics = fields.List(fields.Dict())

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org