@@ -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)
@@ -1099,6 +1102,21 @@ def list_views(self, namespace: str | Identifier) -> list[Identifier]:
10991102 _handle_non_200_response (exc , {404 : NoSuchNamespaceError })
11001103 return [(* view .namespace , view .name ) for view in ListViewsResponse .model_validate_json (response .text ).identifiers ]
11011104
1105+ @retry (** _RETRY_ARGS )
1106+ def load_view (self , identifier : str | Identifier ) -> View :
1107+ self ._check_endpoint (Capability .V1_LOAD_VIEW )
1108+ response = self ._session .get (
1109+ self .url (Endpoints .load_view , prefixed = True , ** self ._split_identifier_for_path (identifier , IdentifierKind .VIEW )),
1110+ params = {},
1111+ )
1112+ try :
1113+ response .raise_for_status ()
1114+ except HTTPError as exc :
1115+ _handle_non_200_response (exc , {404 : NoSuchViewError })
1116+
1117+ view_response = ViewResponse .model_validate_json (response .text )
1118+ return self ._response_to_view (self .identifier_to_tuple (identifier ), view_response )
1119+
11021120 @retry (** _RETRY_ARGS )
11031121 def commit_table (
11041122 self , table : Table , requirements : tuple [TableRequirement , ...], updates : tuple [TableUpdate , ...]
0 commit comments