Skip to content

Commit 45fb782

Browse files
committed
spec: get table under namespace
1 parent 173b530 commit 45fb782

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
@@ -171,6 +171,35 @@ paths:
171171
- application/json
172172
parameters:
173173
- $ref: '#/components/parameters/namespace'
174+
/v1/namespaces/{ns}/tables/{table}:
175+
get:
176+
description: Get a table's detailed properties under a specified namespace from
177+
the catalog.".
178+
operationId: GetTable
179+
parameters:
180+
- $ref: '#/components/parameters/namespace'
181+
- $ref: '#/components/parameters/table'
182+
responses:
183+
"200":
184+
$ref: '#/components/responses/GetTableResponse'
185+
"400":
186+
$ref: '#/components/responses/BadRequestErrorResponse'
187+
"403":
188+
$ref: '#/components/responses/ForbiddenResponse'
189+
"404":
190+
$ref: '#/components/responses/NotFoundResponse'
191+
"503":
192+
$ref: '#/components/responses/ServiceUnavailableResponse'
193+
"5XX":
194+
$ref: '#/components/responses/ServerErrorResponse'
195+
summary: Get a table from the catalog
196+
tags:
197+
- Namespace
198+
x-accepts:
199+
- application/json
200+
parameters:
201+
- $ref: '#/components/parameters/namespace'
202+
- $ref: '#/components/parameters/table'
174203
components:
175204
examples:
176205
ListNamespacesEmptyExample:
@@ -193,6 +222,15 @@ components:
193222
schema:
194223
type: string
195224
style: simple
225+
table:
226+
description: A table name.
227+
explode: false
228+
in: path
229+
name: table
230+
required: true
231+
schema:
232+
type: string
233+
style: simple
196234
responses:
197235
CreateNamespaceResponse:
198236
content:
@@ -226,6 +264,12 @@ components:
226264
$ref: '#/components/schemas/GetNamespaceResponse'
227265
description: "Returns a namespace, as well as any properties stored on the namespace\
228266
\ if namespace properties are supported by the server."
267+
GetTableResponse:
268+
content:
269+
application/json:
270+
schema:
271+
$ref: '#/components/schemas/GetTableResult'
272+
description: Table properties result when loading a table
229273
BadRequestErrorResponse:
230274
content:
231275
application/json:
@@ -429,4 +473,14 @@ components:
429473
nullable: true
430474
required:
431475
- namespace
476+
GetTableResult:
477+
description: |
478+
Result used when a table is successfully loaded.
479+
example:
480+
properties:
481+
key: properties
482+
properties:
483+
properties:
484+
additionalProperties:
485+
type: string
432486

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

@@ -223,6 +224,79 @@ No authorization required
223224
| **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. | - |
224225

225226

227+
## getTable
228+
229+
> GetTableResult getTable(ns, table)
230+
231+
Get a table from the catalog
232+
233+
Get a table's detailed properties under a specified namespace from the catalog.\".
234+
235+
### Example
236+
237+
```java
238+
// Import classes:
239+
import com.lancedb.lance.catalog.client.apache.ApiClient;
240+
import com.lancedb.lance.catalog.client.apache.ApiException;
241+
import com.lancedb.lance.catalog.client.apache.Configuration;
242+
import com.lancedb.lance.catalog.client.apache.models.*;
243+
import com.lancedb.lance.catalog.client.apache.api.NamespaceApi;
244+
245+
public class Example {
246+
public static void main(String[] args) {
247+
ApiClient defaultClient = Configuration.getDefaultApiClient();
248+
defaultClient.setBasePath("http://localhost:2333");
249+
250+
NamespaceApi apiInstance = new NamespaceApi(defaultClient);
251+
String ns = "ns_example"; // String | The name of the namespace.
252+
String table = "table_example"; // String | A table name.
253+
try {
254+
GetTableResult result = apiInstance.getTable(ns, table);
255+
System.out.println(result);
256+
} catch (ApiException e) {
257+
System.err.println("Exception when calling NamespaceApi#getTable");
258+
System.err.println("Status code: " + e.getCode());
259+
System.err.println("Reason: " + e.getResponseBody());
260+
System.err.println("Response headers: " + e.getResponseHeaders());
261+
e.printStackTrace();
262+
}
263+
}
264+
}
265+
```
266+
267+
### Parameters
268+
269+
270+
| Name | Type | Description | Notes |
271+
|------------- | ------------- | ------------- | -------------|
272+
| **ns** | **String**| The name of the namespace. | |
273+
| **table** | **String**| A table name. | |
274+
275+
### Return type
276+
277+
[**GetTableResult**](GetTableResult.md)
278+
279+
### Authorization
280+
281+
No authorization required
282+
283+
### HTTP request headers
284+
285+
- **Content-Type**: Not defined
286+
- **Accept**: application/json
287+
288+
289+
### HTTP response details
290+
| Status code | Description | Response headers |
291+
|-------------|-------------|------------------|
292+
| **200** | Table properties result when loading a table | - |
293+
| **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. | - |
294+
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
295+
| **404** | A server-side problem that means can not find the specified resource. | - |
296+
| **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. | - |
297+
| **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. | - |
298+
299+
226300
## listNamespaces
227301

228302
> 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)