Skip to content

Commit 30a9e9e

Browse files
wojiaodoubaolijinglun
andauthored
feat: add listTables (#117)
Co-authored-by: lijinglun <lijinglun@bytedance.com>
1 parent 6f2f3f3 commit 30a9e9e

36 files changed

Lines changed: 2306 additions & 1 deletion

File tree

docs/src/spec/rest.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,38 @@ paths:
267267
5XX:
268268
$ref: '#/components/responses/ServerErrorResponse'
269269

270+
/v1/table/{id}/list:
271+
parameters:
272+
- $ref: '#/components/parameters/id'
273+
- $ref: '#/components/parameters/delimiter'
274+
post:
275+
tags: [ Table ]
276+
summary: List tables
277+
operationId: ListTables
278+
description: >
279+
List all child table names of the root namespace or a given parent namespace.
280+
requestBody:
281+
required: true
282+
content:
283+
application/json:
284+
schema:
285+
$ref: '#/components/schemas/ListTablesRequest'
286+
responses:
287+
200:
288+
$ref: '#/components/responses/ListTablesResponse'
289+
400:
290+
$ref: '#/components/responses/BadRequestErrorResponse'
291+
401:
292+
$ref: '#/components/responses/UnauthorizedErrorResponse'
293+
403:
294+
$ref: '#/components/responses/ForbiddenErrorResponse'
295+
406:
296+
$ref: '#/components/responses/UnsupportedOperationErrorResponse'
297+
503:
298+
$ref: '#/components/responses/ServiceUnavailableErrorResponse'
299+
5XX:
300+
$ref: '#/components/responses/ServerErrorResponse'
301+
270302
/v1/table/{id}/describe:
271303
parameters:
272304
- $ref: '#/components/parameters/id'
@@ -739,6 +771,32 @@ components:
739771
additionalProperties:
740772
type: string
741773

774+
ListTablesRequest:
775+
type: object
776+
properties:
777+
parent:
778+
type: array
779+
items:
780+
type: string
781+
pageToken:
782+
$ref: "#/components/schemas/PageToken"
783+
pageSize:
784+
$ref: "#/components/schemas/PageSize"
785+
786+
ListTablesResponse:
787+
type: object
788+
required:
789+
- tables
790+
properties:
791+
tables:
792+
type: array
793+
uniqueItems: true
794+
items:
795+
type: string
796+
example: "cart"
797+
nextPageToken:
798+
$ref: "#/components/schemas/PageToken"
799+
742800
DescribeTableRequest:
743801
type: object
744802
required:
@@ -1019,6 +1077,13 @@ components:
10191077
schema:
10201078
$ref: '#/components/schemas/NamespaceExistsResponse'
10211079

1080+
ListTablesResponse:
1081+
description: A list of tables
1082+
content:
1083+
application/json:
1084+
schema:
1085+
$ref: '#/components/schemas/ListTablesResponse'
1086+
10221087
DescribeTableResponse:
10231088
description: Table properties result when loading a table
10241089
content:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
121121
*TableApi* | [**deregisterTable**](docs/TableApi.md#deregisterTable) | **POST** /v1/table/{id}/deregister | Deregister a table from its namespace
122122
*TableApi* | [**describeTable**](docs/TableApi.md#describeTable) | **POST** /v1/table/{id}/describe | Describe a table from the namespace
123123
*TableApi* | [**dropTable**](docs/TableApi.md#dropTable) | **POST** /v1/table/{id}/drop | Drop a table from its namespace
124+
*TableApi* | [**listTables**](docs/TableApi.md#listTables) | **POST** /v1/table/{id}/list | List tables
124125
*TableApi* | [**registerTable**](docs/TableApi.md#registerTable) | **POST** /v1/table/{id}/register | Register a table to a namespace
125126
*TableApi* | [**tableExists**](docs/TableApi.md#tableExists) | **POST** /v1/table/{id}/exists | Check if a table exists
126127
*TransactionApi* | [**alterTransaction**](docs/TransactionApi.md#alterTransaction) | **POST** /v1/transaction/{id}/alter | Alter information of a transaction.
@@ -152,6 +153,8 @@ Class | Method | HTTP request | Description
152153
- [ErrorResponse](docs/ErrorResponse.md)
153154
- [ListNamespacesRequest](docs/ListNamespacesRequest.md)
154155
- [ListNamespacesResponse](docs/ListNamespacesResponse.md)
156+
- [ListTablesRequest](docs/ListTablesRequest.md)
157+
- [ListTablesResponse](docs/ListTablesResponse.md)
155158
- [NamespaceExistsRequest](docs/NamespaceExistsRequest.md)
156159
- [NamespaceExistsResponse](docs/NamespaceExistsResponse.md)
157160
- [RegisterTableRequest](docs/RegisterTableRequest.md)

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,44 @@ paths:
273273
x-content-type: application/json
274274
x-accepts:
275275
- application/json
276+
/v1/table/{id}/list:
277+
parameters:
278+
- $ref: '#/components/parameters/id'
279+
- $ref: '#/components/parameters/delimiter'
280+
post:
281+
description: |
282+
List all child table names of the root namespace or a given parent namespace.
283+
operationId: ListTables
284+
parameters:
285+
- $ref: '#/components/parameters/id'
286+
- $ref: '#/components/parameters/delimiter'
287+
requestBody:
288+
content:
289+
application/json:
290+
schema:
291+
$ref: '#/components/schemas/ListTablesRequest'
292+
required: true
293+
responses:
294+
"200":
295+
$ref: '#/components/responses/ListTablesResponse'
296+
"400":
297+
$ref: '#/components/responses/BadRequestErrorResponse'
298+
"401":
299+
$ref: '#/components/responses/UnauthorizedErrorResponse'
300+
"403":
301+
$ref: '#/components/responses/ForbiddenErrorResponse'
302+
"406":
303+
$ref: '#/components/responses/UnsupportedOperationErrorResponse'
304+
"503":
305+
$ref: '#/components/responses/ServiceUnavailableErrorResponse'
306+
"5XX":
307+
$ref: '#/components/responses/ServerErrorResponse'
308+
summary: List tables
309+
tags:
310+
- Table
311+
x-content-type: application/json
312+
x-accepts:
313+
- application/json
276314
/v1/table/{id}/describe:
277315
parameters:
278316
- $ref: '#/components/parameters/id'
@@ -571,6 +609,12 @@ components:
571609
schema:
572610
$ref: '#/components/schemas/NamespaceExistsResponse'
573611
description: Result of checking if a namespace exists
612+
ListTablesResponse:
613+
content:
614+
application/json:
615+
schema:
616+
$ref: '#/components/schemas/ListTablesResponse'
617+
description: A list of tables
574618
DescribeTableResponse:
575619
content:
576620
application/json:
@@ -1031,6 +1075,54 @@ components:
10311075
- location
10321076
- name
10331077
- namespace
1078+
ListTablesRequest:
1079+
example:
1080+
parent:
1081+
- parent
1082+
- parent
1083+
pageSize: 0
1084+
pageToken: pageToken
1085+
properties:
1086+
parent:
1087+
items:
1088+
type: string
1089+
type: array
1090+
pageToken:
1091+
description: |-
1092+
An opaque token that allows pagination for list APIs (e.g. ListNamespaces).
1093+
For an initial client request for a list API, if the server cannot return all items in one response, or if there are more items than the `pageSize` specified in the client request, the server must return a `nextPageToken` in the response indicating there are more results available.
1094+
After the initial request, the value of `nextPageToken` from each response must be used by the client as the `pageToken` parameter value for the next request.
1095+
Clients must interpret either `null`, missing value or empty string value of `nextPageToken` from a server response as the end of the listing results.
1096+
type: string
1097+
nullable: true
1098+
pageSize:
1099+
description: An inclusive upper bound of the number of results that a client
1100+
will receive.
1101+
type: integer
1102+
nullable: true
1103+
ListTablesResponse:
1104+
example:
1105+
tables:
1106+
- cart
1107+
- cart
1108+
nextPageToken: nextPageToken
1109+
properties:
1110+
tables:
1111+
items:
1112+
example: cart
1113+
type: string
1114+
type: array
1115+
uniqueItems: true
1116+
nextPageToken:
1117+
description: |-
1118+
An opaque token that allows pagination for list APIs (e.g. ListNamespaces).
1119+
For an initial client request for a list API, if the server cannot return all items in one response, or if there are more items than the `pageSize` specified in the client request, the server must return a `nextPageToken` in the response indicating there are more results available.
1120+
After the initial request, the value of `nextPageToken` from each response must be used by the client as the `pageToken` parameter value for the next request.
1121+
Clients must interpret either `null`, missing value or empty string value of `nextPageToken` from a server response as the end of the listing results.
1122+
type: string
1123+
nullable: true
1124+
required:
1125+
- tables
10341126
DescribeTableRequest:
10351127
example:
10361128
name: name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
# ListTablesRequest
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**parent** | **List&lt;String&gt;** | | [optional] |
11+
|**pageToken** | **String** | An opaque token that allows pagination for list APIs (e.g. ListNamespaces). For an initial client request for a list API, if the server cannot return all items in one response, or if there are more items than the &#x60;pageSize&#x60; specified in the client request, the server must return a &#x60;nextPageToken&#x60; in the response indicating there are more results available. After the initial request, the value of &#x60;nextPageToken&#x60; from each response must be used by the client as the &#x60;pageToken&#x60; parameter value for the next request. Clients must interpret either &#x60;null&#x60;, missing value or empty string value of &#x60;nextPageToken&#x60; from a server response as the end of the listing results. | [optional] |
12+
|**pageSize** | **Integer** | An inclusive upper bound of the number of results that a client will receive. | [optional] |
13+
14+
15+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
# ListTablesResponse
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**tables** | **Set&lt;String&gt;** | | |
11+
|**nextPageToken** | **String** | An opaque token that allows pagination for list APIs (e.g. ListNamespaces). For an initial client request for a list API, if the server cannot return all items in one response, or if there are more items than the &#x60;pageSize&#x60; specified in the client request, the server must return a &#x60;nextPageToken&#x60; in the response indicating there are more results available. After the initial request, the value of &#x60;nextPageToken&#x60; from each response must be used by the client as the &#x60;pageToken&#x60; parameter value for the next request. Clients must interpret either &#x60;null&#x60;, missing value or empty string value of &#x60;nextPageToken&#x60; from a server response as the end of the listing results. | [optional] |
12+
13+
14+

java/lance-namespace-apache-client/docs/TableApi.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All URIs are relative to *http://localhost:2333*
77
| [**deregisterTable**](TableApi.md#deregisterTable) | **POST** /v1/table/{id}/deregister | Deregister a table from its namespace |
88
| [**describeTable**](TableApi.md#describeTable) | **POST** /v1/table/{id}/describe | Describe a table from the namespace |
99
| [**dropTable**](TableApi.md#dropTable) | **POST** /v1/table/{id}/drop | Drop a table from its namespace |
10+
| [**listTables**](TableApi.md#listTables) | **POST** /v1/table/{id}/list | List tables |
1011
| [**registerTable**](TableApi.md#registerTable) | **POST** /v1/table/{id}/register | Register a table to a namespace |
1112
| [**tableExists**](TableApi.md#tableExists) | **POST** /v1/table/{id}/exists | Check if a table exists |
1213

@@ -240,6 +241,82 @@ No authorization required
240241
| **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. | - |
241242

242243

244+
## listTables
245+
246+
> ListTablesResponse listTables(id, listTablesRequest, delimiter)
247+
248+
List tables
249+
250+
List all child table names of the root namespace or a given parent namespace.
251+
252+
### Example
253+
254+
```java
255+
// Import classes:
256+
import com.lancedb.lance.namespace.client.apache.ApiClient;
257+
import com.lancedb.lance.namespace.client.apache.ApiException;
258+
import com.lancedb.lance.namespace.client.apache.Configuration;
259+
import com.lancedb.lance.namespace.client.apache.models.*;
260+
import com.lancedb.lance.namespace.client.apache.api.TableApi;
261+
262+
public class Example {
263+
public static void main(String[] args) {
264+
ApiClient defaultClient = Configuration.getDefaultApiClient();
265+
defaultClient.setBasePath("http://localhost:2333");
266+
267+
TableApi apiInstance = new TableApi(defaultClient);
268+
String id = "id_example"; // String | `string identifier` of an object in a namespace, following the Lance Namespace spec. When the value is equal to the delimiter, it represents the root namespace. For example, `v1/namespace/./list` performs a `ListNamespace` on the root namespace.
269+
ListTablesRequest listTablesRequest = new ListTablesRequest(); // ListTablesRequest |
270+
String delimiter = "delimiter_example"; // String | An optional delimiter of the `string identifier`, following the Lance Namespace spec. When not specified, the `.` delimiter must be used.
271+
try {
272+
ListTablesResponse result = apiInstance.listTables(id, listTablesRequest, delimiter);
273+
System.out.println(result);
274+
} catch (ApiException e) {
275+
System.err.println("Exception when calling TableApi#listTables");
276+
System.err.println("Status code: " + e.getCode());
277+
System.err.println("Reason: " + e.getResponseBody());
278+
System.err.println("Response headers: " + e.getResponseHeaders());
279+
e.printStackTrace();
280+
}
281+
}
282+
}
283+
```
284+
285+
### Parameters
286+
287+
288+
| Name | Type | Description | Notes |
289+
|------------- | ------------- | ------------- | -------------|
290+
| **id** | **String**| &#x60;string identifier&#x60; of an object in a namespace, following the Lance Namespace spec. When the value is equal to the delimiter, it represents the root namespace. For example, &#x60;v1/namespace/./list&#x60; performs a &#x60;ListNamespace&#x60; on the root namespace. | |
291+
| **listTablesRequest** | [**ListTablesRequest**](ListTablesRequest.md)| | |
292+
| **delimiter** | **String**| An optional delimiter of the &#x60;string identifier&#x60;, following the Lance Namespace spec. When not specified, the &#x60;.&#x60; delimiter must be used. | [optional] |
293+
294+
### Return type
295+
296+
[**ListTablesResponse**](ListTablesResponse.md)
297+
298+
### Authorization
299+
300+
No authorization required
301+
302+
### HTTP request headers
303+
304+
- **Content-Type**: application/json
305+
- **Accept**: application/json
306+
307+
308+
### HTTP response details
309+
| Status code | Description | Response headers |
310+
|-------------|-------------|------------------|
311+
| **200** | A list of tables | - |
312+
| **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&#39;s middleware. | - |
313+
| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
314+
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
315+
| **406** | Not Acceptable / Unsupported Operation. The server does not support this operation. | - |
316+
| **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. | - |
317+
| **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. | - |
318+
319+
243320
## registerTable
244321

245322
> RegisterTableResponse registerTable(id, registerTableRequest, delimiter)

0 commit comments

Comments
 (0)