From 766c5022b6bafb1f0f0097bf3d43a5b39d3ffb80 Mon Sep 17 00:00:00 2001 From: KBolashev Date: Sun, 21 Jul 2024 18:18:36 +0300 Subject: [PATCH] Filter the metadata fields based on the introspection --- dagshub/data_engine/client/gql_queries.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dagshub/data_engine/client/gql_queries.py b/dagshub/data_engine/client/gql_queries.py index 697b3949..76df00b9 100644 --- a/dagshub/data_engine/client/gql_queries.py +++ b/dagshub/data_engine/client/gql_queries.py @@ -42,7 +42,12 @@ def datasource_params(id: Optional[Union[int, str]], name: Optional[str]) -> Dic @staticmethod @functools.lru_cache() def datasource_query(include_metadata: bool, introspection: "TypesIntrospection") -> GqlQuery: - metadata_fields = "metadata { key value timeZone }" if include_metadata else "" + metadata_fields = "" + if include_metadata: + # Filter out the unavailable fields + queryable_fields = ["key", "value", "timeZone"] + queryable_fields = Validators.filter_supported_fields(queryable_fields, "MetadataField", introspection) + metadata_fields = "metadata " + "{" + " ".join(queryable_fields) + "}" q = ( GqlQuery() .operation(