@@ -505,22 +505,6 @@ def _execute_materialized_endpoint(
505505 return self ._execute_query_and_respond (
506506 query_request_data , data .client_query_id , request , extra_result_fields = extra_fields
507507 )
508- except (ExposedHogQLError , ExposedCHQueryError , HogVMException ) as e :
509- raise ValidationError (str (e ), getattr (e , "code_name" , None ))
510- except ResolutionError as e :
511- raise ValidationError (str (e ))
512- except ConcurrencyLimitExceeded as c :
513- capture_exception (
514- c ,
515- {
516- "product" : Product .ENDPOINTS ,
517- "team_id" : self .team_id ,
518- "endpoint_name" : endpoint .name ,
519- "materialized" : True ,
520- "saved_query_id" : saved_query .id if saved_query else None ,
521- },
522- )
523- raise Throttled (detail = "Too many concurrent requests. Please try again later." )
524508 except Exception as e :
525509 capture_exception (
526510 e ,
@@ -581,19 +565,14 @@ def _execute_inline_endpoint(
581565 query_request_data , data .client_query_id , request , cache_age_seconds = endpoint .cache_age_seconds
582566 )
583567
584- except (ExposedHogQLError , ExposedCHQueryError , HogVMException ) as e :
585- raise ValidationError (str (e ), getattr (e , "code_name" , None ))
586- except ResolutionError as e :
587- raise ValidationError (str (e ))
588- except ConcurrencyLimitExceeded as c :
589- raise Throttled (detail = str (c ))
590568 except Exception as e :
591569 self .handle_column_ch_error (e )
592570 capture_exception (
593571 e ,
594572 {
595573 "product" : Product .ENDPOINTS ,
596574 "team_id" : self .team_id ,
575+ "materialized" : False ,
597576 "endpoint_name" : endpoint .name ,
598577 },
599578 )
@@ -641,13 +620,19 @@ def run(self, request: Request, name=None, *args, **kwargs) -> Response:
641620 # Only the latest version is materialized
642621 use_materialized = version_number is None and self ._should_use_materialized_table (endpoint , data )
643622
644- if use_materialized :
645- result = self ._execute_materialized_endpoint (endpoint , data , request )
646- else :
647- # Use version's query if available, otherwise use endpoint.query
648- query_to_use = version_obj .query if version_obj else endpoint .query .copy ()
649- result = self ._execute_inline_endpoint (endpoint , data , request , query_to_use )
650-
623+ try :
624+ if use_materialized :
625+ result = self ._execute_materialized_endpoint (endpoint , data , request )
626+ else :
627+ # Use version's query if available, otherwise use endpoint.query
628+ query_to_use = version_obj .query if version_obj else endpoint .query .copy ()
629+ result = self ._execute_inline_endpoint (endpoint , data , request , query_to_use )
630+ except (ExposedHogQLError , ExposedCHQueryError , HogVMException ) as e :
631+ raise ValidationError (str (e ), getattr (e , "code_name" , None ))
632+ except ResolutionError as e :
633+ raise ValidationError (str (e ))
634+ except ConcurrencyLimitExceeded :
635+ raise Throttled (detail = "Too many concurrent requests. Please try again later." )
651636 if version_obj and isinstance (result .data , dict ):
652637 result .data ["endpoint_version" ] = version_obj .version
653638 result .data ["endpoint_version_created_at" ] = version_obj .created_at .isoformat ()
0 commit comments