@@ -152,6 +152,7 @@ class Endpoints:
152152 get_token : str = "oauth/tokens"
153153 rename_table : str = "tables/rename"
154154 list_views : str = "namespaces/{namespace}/views"
155+ load_view : str = "namespaces/{namespace}/views/{view}"
155156 create_view : str = "namespaces/{namespace}/views"
156157 drop_view : str = "namespaces/{namespace}/views/{view}"
157158 view_exists : str = "namespaces/{namespace}/views/{view}"
@@ -180,6 +181,7 @@ class Capability:
180181 V1_REGISTER_TABLE = Endpoint (http_method = HttpMethod .POST , path = f"{ API_PREFIX } /{ Endpoints .register_table } " )
181182
182183 V1_LIST_VIEWS = Endpoint (http_method = HttpMethod .GET , path = f"{ API_PREFIX } /{ Endpoints .list_views } " )
184+ V1_LOAD_VIEW = Endpoint (http_method = HttpMethod .GET , path = f"{ API_PREFIX } /{ Endpoints .load_view } " )
183185 V1_VIEW_EXISTS = Endpoint (http_method = HttpMethod .HEAD , path = f"{ API_PREFIX } /{ Endpoints .view_exists } " )
184186 V1_DELETE_VIEW = Endpoint (http_method = HttpMethod .DELETE , path = f"{ API_PREFIX } /{ Endpoints .drop_view } " )
185187 V1_SUBMIT_TABLE_SCAN_PLAN = Endpoint (http_method = HttpMethod .POST , path = f"{ API_PREFIX } /{ Endpoints .plan_table_scan } " )
@@ -209,6 +211,7 @@ class Capability:
209211VIEW_ENDPOINTS : frozenset [Endpoint ] = frozenset (
210212 (
211213 Capability .V1_LIST_VIEWS ,
214+ Capability .V1_LOAD_VIEW ,
212215 Capability .V1_DELETE_VIEW ,
213216 )
214217)
@@ -1106,6 +1109,21 @@ def list_views(self, namespace: str | Identifier) -> list[Identifier]:
11061109 _handle_non_200_response (exc , {404 : NoSuchNamespaceError })
11071110 return [(* view .namespace , view .name ) for view in ListViewsResponse .model_validate_json (response .text ).identifiers ]
11081111
1112+ @retry (** _RETRY_ARGS )
1113+ def load_view (self , identifier : str | Identifier ) -> View :
1114+ self ._check_endpoint (Capability .V1_LOAD_VIEW )
1115+ response = self ._session .get (
1116+ self .url (Endpoints .load_view , prefixed = True , ** self ._split_identifier_for_path (identifier , IdentifierKind .VIEW )),
1117+ params = {},
1118+ )
1119+ try :
1120+ response .raise_for_status ()
1121+ except HTTPError as exc :
1122+ _handle_non_200_response (exc , {404 : NoSuchViewError })
1123+
1124+ view_response = ViewResponse .model_validate_json (response .text )
1125+ return self ._response_to_view (self .identifier_to_tuple (identifier ), view_response )
1126+
11091127 @retry (** _RETRY_ARGS )
11101128 def commit_table (
11111129 self , table : Table , requirements : tuple [TableRequirement , ...], updates : tuple [TableUpdate , ...]
0 commit comments