99from infrahub .api .dependencies import BranchParams , get_branch_params , get_current_user , get_db
1010from infrahub .core import registry
1111from infrahub .core .constants import InfrahubKind
12+ from infrahub .core .protocols import CoreGraphQLQuery
1213from infrahub .database import InfrahubDatabase # noqa: TCH001
1314from infrahub .graphql .analyzer import InfrahubGraphQLQueryAnalyzer
1415from infrahub .graphql .api .dependencies import build_graphql_query_permission_checker
@@ -52,14 +53,14 @@ async def execute_query(
5253 account_session : AccountSession ,
5354) -> dict [str , Any ]:
5455 gql_query = await registry .manager .get_one_by_id_or_default_filter (
55- db = db , id = query_id , kind = InfrahubKind . GRAPHQLQUERY , branch = branch_params .branch , at = branch_params .at
56+ db = db , id = query_id , kind = CoreGraphQLQuery , branch = branch_params .branch , at = branch_params .at
5657 )
5758
5859 gql_params = prepare_graphql_params (
5960 db = db , branch = branch_params .branch , at = branch_params .at , account_session = account_session
6061 )
6162 analyzed_query = InfrahubGraphQLQueryAnalyzer (
62- query = gql_query .query .value , # type: ignore[attr-defined]
63+ query = gql_query .query .value ,
6364 schema = gql_params .schema ,
6465 branch = branch_params .branch ,
6566 )
@@ -75,20 +76,20 @@ async def execute_query(
7576 "type" : "mutation" if analyzed_query .contains_mutation else "query" ,
7677 "branch" : branch_params .branch .name ,
7778 "operation" : "" ,
78- "name" : gql_query .name .value , # type: ignore[attr-defined]
79+ "name" : gql_query .name .value ,
7980 "query_id" : query_id ,
8081 }
8182
8283 with GRAPHQL_DURATION_METRICS .labels (** labels ).time ():
8384 result = await graphql (
8485 schema = gql_params .schema ,
85- source = gql_query .query .value , # type: ignore[attr-defined]
86+ source = gql_query .query .value ,
8687 context_value = gql_params .context ,
8788 root_value = None ,
8889 variable_values = params ,
8990 )
9091
91- data = extract_data (query_name = gql_query .name .value , result = result ) # type: ignore[attr-defined]
92+ data = extract_data (query_name = gql_query .name .value , result = result )
9293
9394 GRAPHQL_RESPONSE_SIZE_METRICS .labels (** labels ).observe (len (data ))
9495 GRAPHQL_QUERY_DEPTH_METRICS .labels (** labels ).observe (await analyzed_query .calculate_depth ())
@@ -109,7 +110,7 @@ async def execute_query(
109110 message = messages .RequestGraphQLQueryGroupUpdate (
110111 branch = branch_params .branch .name ,
111112 query_id = gql_query .id ,
112- query_name = gql_query .name .value , # type: ignore[attr-defined]
113+ query_name = gql_query .name .value ,
113114 related_node_ids = sorted (list (related_node_ids )),
114115 subscribers = sorted (subscribers ),
115116 params = params ,
0 commit comments