You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/05/23 18:41:41 UTC

[GitHub] [superset] AAfghahi commented on a diff in pull request #20136: feat: Add Certified filter to Datasets

AAfghahi commented on code in PR #20136:
URL: https://github.com/apache/superset/pull/20136#discussion_r879767322


##########
superset/datasets/api.py:
##########
@@ -195,7 +195,11 @@ class DatasetRestApi(BaseSupersetModelRestApi):
         "owners": RelatedFieldFilter("first_name", FilterRelatedOwners),
         "database": "database_name",
     }
-    search_filters = {"sql": [DatasetIsNullOrEmptyFilter]}
+    search_filters = {
+        "sql": [DatasetIsNullOrEmptyFilter],
+        "id": [DatasetCertifiedFilter],
+    }
+    search_columns = ["id", "database", "owners", "sql", "table_name"]

Review Comment:
   I believe that this limits search to only these columns, is that the intention?



##########
superset/datasets/filters.py:
##########
@@ -33,3 +35,21 @@ def apply(self, query: Query, value: bool) -> Query:
             filter_clause = not_(filter_clause)
 
         return query.filter(filter_clause)
+
+
+class DatasetCertifiedFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    name = _("Is certified")
+    arg_name = "dataset_is_certified"
+
+    def apply(self, query: Query, value: Any) -> Query:

Review Comment:
   it looks like value here is just a boolean?



-- 
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