Skip to content

Commit 6f1bbab

Browse files
committed
spec: get table under namespace
1 parent b60641f commit 6f1bbab

18 files changed

Lines changed: 814 additions & 0 deletions

File tree

java/lance-catalog-apache-client/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ docs/CreateNamespaceRequest.md
55
docs/CreateNamespaceResponse.md
66
docs/ErrorModel.md
77
docs/GetNamespaceResponse.md
8+
docs/GetTableResult.md
89
docs/ListNamespacesResponse.md
910
docs/NamespaceApi.md
1011
pom.xml
@@ -28,4 +29,5 @@ src/main/java/com/lancedb/lance/catalog/client/apache/model/CreateNamespaceReque
2829
src/main/java/com/lancedb/lance/catalog/client/apache/model/CreateNamespaceResponse.java
2930
src/main/java/com/lancedb/lance/catalog/client/apache/model/ErrorModel.java
3031
src/main/java/com/lancedb/lance/catalog/client/apache/model/GetNamespaceResponse.java
32+
src/main/java/com/lancedb/lance/catalog/client/apache/model/GetTableResult.java
3133
src/main/java/com/lancedb/lance/catalog/client/apache/model/ListNamespacesResponse.java

java/lance-catalog-apache-client/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Class | Method | HTTP request | Description
117117
*NamespaceApi* | [**createNamespace**](docs/NamespaceApi.md#createNamespace) | **POST** /v1/namespaces | Create a new namespace. A catalog can manage one or more namespaces. A namespace is used to manage one or more tables. There are three modes when trying to create a namespace: * CREATE: Create the namespace if it does not exist. If a namespace of the same name already exists, the operation fails with 400. * EXIST_OK: Create the namespace if it does not exist. If a namespace of the same name already exists, the operation succeeds and the existing namespace is kept. * OVERWRITE: Create the namespace if it does not exist. If a namespace of the same name already exists, the existing namespace is dropped and a new namespace with this name with no table is created.
118118
*NamespaceApi* | [**dropNamespace**](docs/NamespaceApi.md#dropNamespace) | **DELETE** /v1/namespaces/{ns} | Drop a namespace from the catalog. Namespace must be empty.
119119
*NamespaceApi* | [**getNamespace**](docs/NamespaceApi.md#getNamespace) | **GET** /v1/namespaces/{ns} | Get information about a namespace
120+
*NamespaceApi* | [**getTable**](docs/NamespaceApi.md#getTable) | **GET** /v1/namespaces/{ns}/tables/{table} | Get a table from the catalog
120121
*NamespaceApi* | [**listNamespaces**](docs/NamespaceApi.md#listNamespaces) | **GET** /v1/namespaces | List all namespaces in the catalog.
121122
*NamespaceApi* | [**namespaceExists**](docs/NamespaceApi.md#namespaceExists) | **HEAD** /v1/namespaces/{ns} | Check if a namespace exists
122123

@@ -127,6 +128,7 @@ Class | Method | HTTP request | Description
127128
- [CreateNamespaceResponse](docs/CreateNamespaceResponse.md)
128129
- [ErrorModel](docs/ErrorModel.md)
129130
- [GetNamespaceResponse](docs/GetNamespaceResponse.md)
131+
- [GetTableResult](docs/GetTableResult.md)
130132
- [ListNamespacesResponse](docs/ListNamespacesResponse.md)
131133

132134

java/lance-catalog-apache-client/api/openapi.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,35 @@ paths:
161161
- application/json
162162
parameters:
163163
- $ref: '#/components/parameters/namespace'
164+
/v1/namespaces/{ns}/tables/{table}:
165+
get:
166+
description: Get a table's detailed properties under a specified namespace from
167+
the catalog.".
168+
operationId: GetTable
169+
parameters:
170+
- $ref: '#/components/parameters/namespace'
171+
- $ref: '#/components/parameters/table'
172+
responses:
173+
"200":
174+
$ref: '#/components/responses/GetTableResponse'
175+
"400":
176+
$ref: '#/components/responses/BadRequestErrorResponse'
177+
"403":
178+
$ref: '#/components/responses/ForbiddenResponse'
179+
"404":
180+
$ref: '#/components/responses/NotFoundResponse'
181+
"503":
182+
$ref: '#/components/responses/ServiceUnavailableResponse'
183+
"5XX":
184+
$ref: '#/components/responses/ServerErrorResponse'
185+
summary: Get a table from the catalog
186+
tags:
187+
- Namespace
188+
x-accepts:
189+
- application/json
190+
parameters:
191+
- $ref: '#/components/parameters/namespace'
192+
- $ref: '#/components/parameters/table'
164193
components:
165194
examples:
166195
ListNamespacesEmptyExample:
@@ -183,6 +212,15 @@ components:
183212
schema:
184213
type: string
185214
style: simple
215+
table:
216+
description: A table name.
217+
explode: false
218+
in: path
219+
name: table
220+
required: true
221+
schema:
222+
type: string
223+
style: simple
186224
responses:
187225
CreateNamespaceResponse:
188226
content:
@@ -216,6 +254,12 @@ components:
216254
$ref: '#/components/schemas/GetNamespaceResponse'
217255
description: "Returns a namespace, as well as any properties stored on the namespace\
218256
\ if namespace properties are supported by the server."
257+
GetTableResponse:
258+
content:
259+
application/json:
260+
schema:
261+
$ref: '#/components/schemas/GetTableResult'
262+
description: Table properties result when loading a table
219263
BadRequestErrorResponse:
220264
content:
221265
application/json:
@@ -406,4 +450,14 @@ components:
406450
nullable: true
407451
required:
408452
- namespace
453+
GetTableResult:
454+
description: |
455+
Result used when a table is successfully loaded.
456+
example:
457+
properties:
458+
key: properties
459+
properties:
460+
properties:
461+
additionalProperties:
462+
type: string
409463

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
# GetTableResult
4+
5+
Result used when a table is successfully loaded.
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**properties** | **Map<String, String>** | | [optional] |
12+
13+
14+

java/lance-catalog-apache-client/docs/NamespaceApi.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All URIs are relative to *http://localhost:2333*
77
| [**createNamespace**](NamespaceApi.md#createNamespace) | **POST** /v1/namespaces | Create a new namespace. A catalog can manage one or more namespaces. A namespace is used to manage one or more tables. There are three modes when trying to create a namespace: * CREATE: Create the namespace if it does not exist. If a namespace of the same name already exists, the operation fails with 400. * EXIST_OK: Create the namespace if it does not exist. If a namespace of the same name already exists, the operation succeeds and the existing namespace is kept. * OVERWRITE: Create the namespace if it does not exist. If a namespace of the same name already exists, the existing namespace is dropped and a new namespace with this name with no table is created. |
88
| [**dropNamespace**](NamespaceApi.md#dropNamespace) | **DELETE** /v1/namespaces/{ns} | Drop a namespace from the catalog. Namespace must be empty. |
99
| [**getNamespace**](NamespaceApi.md#getNamespace) | **GET** /v1/namespaces/{ns} | Get information about a namespace |
10+
| [**getTable**](NamespaceApi.md#getTable) | **GET** /v1/namespaces/{ns}/tables/{table} | Get a table from the catalog |
1011
| [**listNamespaces**](NamespaceApi.md#listNamespaces) | **GET** /v1/namespaces | List all namespaces in the catalog. |
1112
| [**namespaceExists**](NamespaceApi.md#namespaceExists) | **HEAD** /v1/namespaces/{ns} | Check if a namespace exists |
1213

@@ -220,6 +221,79 @@ No authorization required
220221
| **5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
221222

222223

224+
## getTable
225+
226+
> GetTableResult getTable(ns, table)
227+
228+
Get a table from the catalog
229+
230+
Get a table's detailed properties under a specified namespace from the catalog.\".
231+
232+
### Example
233+
234+
```java
235+
// Import classes:
236+
import com.lancedb.lance.catalog.client.apache.ApiClient;
237+
import com.lancedb.lance.catalog.client.apache.ApiException;
238+
import com.lancedb.lance.catalog.client.apache.Configuration;
239+
import com.lancedb.lance.catalog.client.apache.models.*;
240+
import com.lancedb.lance.catalog.client.apache.api.NamespaceApi;
241+
242+
public class Example {
243+
public static void main(String[] args) {
244+
ApiClient defaultClient = Configuration.getDefaultApiClient();
245+
defaultClient.setBasePath("http://localhost:2333");
246+
247+
NamespaceApi apiInstance = new NamespaceApi(defaultClient);
248+
String ns = "ns_example"; // String | The name of the namespace.
249+
String table = "table_example"; // String | A table name.
250+
try {
251+
GetTableResult result = apiInstance.getTable(ns, table);
252+
System.out.println(result);
253+
} catch (ApiException e) {
254+
System.err.println("Exception when calling NamespaceApi#getTable");
255+
System.err.println("Status code: " + e.getCode());
256+
System.err.println("Reason: " + e.getResponseBody());
257+
System.err.println("Response headers: " + e.getResponseHeaders());
258+
e.printStackTrace();
259+
}
260+
}
261+
}
262+
```
263+
264+
### Parameters
265+
266+
267+
| Name | Type | Description | Notes |
268+
|------------- | ------------- | ------------- | -------------|
269+
| **ns** | **String**| The name of the namespace. | |
270+
| **table** | **String**| A table name. | |
271+
272+
### Return type
273+
274+
[**GetTableResult**](GetTableResult.md)
275+
276+
### Authorization
277+
278+
No authorization required
279+
280+
### HTTP request headers
281+
282+
- **Content-Type**: Not defined
283+
- **Accept**: application/json
284+
285+
286+
### HTTP response details
287+
| Status code | Description | Response headers |
288+
|-------------|-------------|------------------|
289+
| **200** | Table properties result when loading a table | - |
290+
| **400** | Indicates a bad request error. It could be caused by an unexpected request body format or other forms of request validation failure, such as invalid json. Usually serves application/json content, although in some cases simple text/plain content might be returned by the server's middleware. | - |
291+
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
292+
| **404** | A server-side problem that means can not find the specified resource. | - |
293+
| **503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
294+
| **5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
295+
296+
223297
## listNamespaces
224298

225299
> ListNamespacesResponse listNamespaces()

java/lance-catalog-apache-client/src/main/java/com/lancedb/lance/catalog/client/apache/api/NamespaceApi.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.lancedb.lance.catalog.client.apache.model.CreateNamespaceRequest;
2222
import com.lancedb.lance.catalog.client.apache.model.CreateNamespaceResponse;
2323
import com.lancedb.lance.catalog.client.apache.model.GetNamespaceResponse;
24+
import com.lancedb.lance.catalog.client.apache.model.GetTableResult;
2425
import com.lancedb.lance.catalog.client.apache.model.ListNamespacesResponse;
2526

2627
import com.fasterxml.jackson.core.type.TypeReference;
@@ -267,6 +268,88 @@ public GetNamespaceResponse getNamespace(String ns, Map<String, String> addition
267268
localVarReturnType);
268269
}
269270

271+
/**
272+
* Get a table from the catalog Get a table&#39;s detailed properties under a specified namespace
273+
* from the catalog.\&quot;.
274+
*
275+
* @param ns The name of the namespace. (required)
276+
* @param table A table name. (required)
277+
* @return GetTableResult
278+
* @throws ApiException if fails to make API call
279+
*/
280+
public GetTableResult getTable(String ns, String table) throws ApiException {
281+
return this.getTable(ns, table, Collections.emptyMap());
282+
}
283+
284+
/**
285+
* Get a table from the catalog Get a table&#39;s detailed properties under a specified namespace
286+
* from the catalog.\&quot;.
287+
*
288+
* @param ns The name of the namespace. (required)
289+
* @param table A table name. (required)
290+
* @param additionalHeaders additionalHeaders for this call
291+
* @return GetTableResult
292+
* @throws ApiException if fails to make API call
293+
*/
294+
public GetTableResult getTable(String ns, String table, Map<String, String> additionalHeaders)
295+
throws ApiException {
296+
Object localVarPostBody = null;
297+
298+
// verify the required parameter 'ns' is set
299+
if (ns == null) {
300+
throw new ApiException(400, "Missing the required parameter 'ns' when calling getTable");
301+
}
302+
303+
// verify the required parameter 'table' is set
304+
if (table == null) {
305+
throw new ApiException(400, "Missing the required parameter 'table' when calling getTable");
306+
}
307+
308+
// create path and map variables
309+
String localVarPath =
310+
"/v1/namespaces/{ns}/tables/{table}"
311+
.replaceAll(
312+
"\\{" + "ns" + "\\}", apiClient.escapeString(apiClient.parameterToString(ns)))
313+
.replaceAll(
314+
"\\{" + "table" + "\\}",
315+
apiClient.escapeString(apiClient.parameterToString(table)));
316+
317+
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
318+
String localVarQueryParameterBaseName;
319+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
320+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
321+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
322+
Map<String, String> localVarCookieParams = new HashMap<String, String>();
323+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
324+
325+
localVarHeaderParams.putAll(additionalHeaders);
326+
327+
final String[] localVarAccepts = {"application/json"};
328+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
329+
330+
final String[] localVarContentTypes = {};
331+
332+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
333+
334+
String[] localVarAuthNames = new String[] {};
335+
336+
TypeReference<GetTableResult> localVarReturnType = new TypeReference<GetTableResult>() {};
337+
return apiClient.invokeAPI(
338+
localVarPath,
339+
"GET",
340+
localVarQueryParams,
341+
localVarCollectionQueryParams,
342+
localVarQueryStringJoiner.toString(),
343+
localVarPostBody,
344+
localVarHeaderParams,
345+
localVarCookieParams,
346+
localVarFormParams,
347+
localVarAccept,
348+
localVarContentType,
349+
localVarAuthNames,
350+
localVarReturnType);
351+
}
352+
270353
/**
271354
* List all namespaces in the catalog.
272355
*

0 commit comments

Comments
 (0)