1212 validate_query_parameters ,
1313)
1414from dbtsl .models import Dimension , Entity , Measure , Metric
15+ from dbtsl .models .environment import EnvironmentInfo
1516from dbtsl .models .query import QueryId , QueryResult , QueryStatus
1617from dbtsl .models .saved_query import SavedQuery
1718
@@ -358,6 +359,29 @@ def parse_response(self, data: Dict[str, Any]) -> str:
358359 return cast (str , data ["compileSql" ]["sql" ])
359360
360361
362+ class GetEnvironmentInfoOperation (ProtocolOperation [EmptyVariables , EnvironmentInfo ]):
363+ """Get information about the Semantic Layer environment."""
364+
365+ @override
366+ def get_request_text (self , * , lazy : bool ) -> str :
367+ query = """
368+ query getEnvironmentInfo($environmentId: BigInt!) {
369+ environmentInfo(environmentId: $environmentId) {
370+ ...&fragment
371+ }
372+ }
373+ """
374+ return render_query (query , EnvironmentInfo .gql_fragments (lazy = lazy ))
375+
376+ @override
377+ def get_request_variables (self , environment_id : int , variables : EmptyVariables ) -> Dict [str , Any ]:
378+ return {"environmentId" : environment_id }
379+
380+ @override
381+ def parse_response (self , data : Dict [str , Any ]) -> EnvironmentInfo :
382+ return decode_to_dataclass (data ["environmentInfo" ], EnvironmentInfo )
383+
384+
361385class GraphQLProtocol :
362386 """Holds the GraphQL implementation for each of method in the API.
363387
@@ -373,3 +397,4 @@ class GraphQLProtocol:
373397 create_query = CreateQueryOperation ()
374398 get_query_result = GetQueryResultOperation ()
375399 compile_sql = CompileSqlOperation ()
400+ environment_info = GetEnvironmentInfoOperation ()
0 commit comments