diff --git a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ClientToServerResponse.java b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ClientToServerResponse.java index 8837b82dd..ae92a18f5 100644 --- a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ClientToServerResponse.java +++ b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ClientToServerResponse.java @@ -15,7 +15,9 @@ import com.lancedb.lance.namespace.server.springboot.model.AlterTransactionResponse; import com.lancedb.lance.namespace.server.springboot.model.CreateNamespaceResponse; +import com.lancedb.lance.namespace.server.springboot.model.DeregisterTableResponse; import com.lancedb.lance.namespace.server.springboot.model.DropNamespaceResponse; +import com.lancedb.lance.namespace.server.springboot.model.DropTableResponse; import com.lancedb.lance.namespace.server.springboot.model.GetNamespaceResponse; import com.lancedb.lance.namespace.server.springboot.model.GetTableResponse; import com.lancedb.lance.namespace.server.springboot.model.GetTransactionResponse; @@ -94,6 +96,27 @@ public static TableExistsResponse tableExists( return converted; } + public static DropTableResponse dropTable( + com.lancedb.lance.namespace.model.DropTableResponse response) { + DropTableResponse converted = new DropTableResponse(); + converted.setName(response.getName()); + converted.setNamespace(response.getNamespace()); + converted.setLocation(response.getLocation()); + converted.setProperties(response.getProperties()); + converted.setTransactionId(response.getTransactionId()); + return converted; + } + + public static DeregisterTableResponse deregisterTable( + com.lancedb.lance.namespace.model.DeregisterTableResponse response) { + DeregisterTableResponse converted = new DeregisterTableResponse(); + converted.setName(response.getName()); + converted.setNamespace(response.getNamespace()); + converted.setLocation(response.getLocation()); + converted.setProperties(response.getProperties()); + return converted; + } + public static GetTransactionResponse getTransaction( com.lancedb.lance.namespace.model.GetTransactionResponse response) { GetTransactionResponse converted = new GetTransactionResponse(); @@ -108,7 +131,6 @@ public static AlterTransactionResponse alterTransaction( AlterTransactionResponse converted = new AlterTransactionResponse(); converted.setId(response.getId()); converted.setStatus(TransactionStatus.valueOf(response.getStatus().name())); - converted.setProperties(response.getProperties()); return converted; } } diff --git a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ServerToClientRequest.java b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ServerToClientRequest.java index fd85ba228..c90bcfb57 100644 --- a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ServerToClientRequest.java +++ b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/ServerToClientRequest.java @@ -19,7 +19,9 @@ import com.lancedb.lance.namespace.model.AlterTransactionSetStatus; import com.lancedb.lance.namespace.model.AlterTransactionUnsetProperty; import com.lancedb.lance.namespace.model.CreateNamespaceRequest; +import com.lancedb.lance.namespace.model.DeregisterTableRequest; import com.lancedb.lance.namespace.model.DropNamespaceRequest; +import com.lancedb.lance.namespace.model.DropTableRequest; import com.lancedb.lance.namespace.model.GetNamespaceRequest; import com.lancedb.lance.namespace.model.GetTableRequest; import com.lancedb.lance.namespace.model.GetTransactionRequest; @@ -99,6 +101,22 @@ public static TableExistsRequest tableExists( return converted; } + public static DropTableRequest dropTable( + com.lancedb.lance.namespace.server.springboot.model.DropTableRequest request) { + DropTableRequest converted = new DropTableRequest(); + converted.setName(request.getName()); + converted.setNamespace(request.getNamespace()); + return converted; + } + + public static DeregisterTableRequest deregisterTable( + com.lancedb.lance.namespace.server.springboot.model.DeregisterTableRequest request) { + DeregisterTableRequest converted = new DeregisterTableRequest(); + converted.setName(request.getName()); + converted.setNamespace(request.getNamespace()); + return converted; + } + public static GetTransactionRequest getTransaction( com.lancedb.lance.namespace.server.springboot.model.GetTransactionRequest request) { GetTransactionRequest converted = new GetTransactionRequest(); diff --git a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/TableController.java b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/TableController.java index c83dded0e..0fdf5a18c 100644 --- a/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/TableController.java +++ b/java/lance-namespace-adapter/src/main/java/com/lancedb/lance/namespace/adapter/TableController.java @@ -15,6 +15,10 @@ import com.lancedb.lance.namespace.LanceNamespace; import com.lancedb.lance.namespace.server.springboot.api.TableApi; +import com.lancedb.lance.namespace.server.springboot.model.DeregisterTableRequest; +import com.lancedb.lance.namespace.server.springboot.model.DeregisterTableResponse; +import com.lancedb.lance.namespace.server.springboot.model.DropTableRequest; +import com.lancedb.lance.namespace.server.springboot.model.DropTableResponse; import com.lancedb.lance.namespace.server.springboot.model.GetTableRequest; import com.lancedb.lance.namespace.server.springboot.model.GetTableResponse; import com.lancedb.lance.namespace.server.springboot.model.RegisterTableRequest; @@ -55,4 +59,20 @@ public ResponseEntity tableExists(TableExistsRequest tableE ClientToServerResponse.tableExists( delegate.tableExists(ServerToClientRequest.tableExists(tableExistsRequest)))); } + + @Override + public ResponseEntity dropTable(DropTableRequest dropTableRequest) { + return ResponseEntity.ok( + ClientToServerResponse.dropTable( + delegate.dropTable(ServerToClientRequest.dropTable(dropTableRequest)))); + } + + @Override + public ResponseEntity deregisterTable( + DeregisterTableRequest deregisterTableRequest) { + return ResponseEntity.ok( + ClientToServerResponse.deregisterTable( + delegate.deregisterTable( + ServerToClientRequest.deregisterTable(deregisterTableRequest)))); + } } diff --git a/java/lance-namespace-apache-client/README.md b/java/lance-namespace-apache-client/README.md index fe6da1b94..a52c36a45 100644 --- a/java/lance-namespace-apache-client/README.md +++ b/java/lance-namespace-apache-client/README.md @@ -116,6 +116,8 @@ Class | Method | HTTP request | Description *NamespaceApi* | [**getNamespace**](docs/NamespaceApi.md#getNamespace) | **POST** /GetNamespace | Get information about a namespace *NamespaceApi* | [**listNamespaces**](docs/NamespaceApi.md#listNamespaces) | **POST** /ListNamespaces | List namespaces *NamespaceApi* | [**namespaceExists**](docs/NamespaceApi.md#namespaceExists) | **POST** /NamespaceExists | Check if a namespace exists +*TableApi* | [**deregisterTable**](docs/TableApi.md#deregisterTable) | **POST** /DeregisterTable | Deregister a table from its namespace +*TableApi* | [**dropTable**](docs/TableApi.md#dropTable) | **POST** /DropTable | Drop a table from its namespace *TableApi* | [**getTable**](docs/TableApi.md#getTable) | **POST** /GetTable | Get a table from the namespace *TableApi* | [**registerTable**](docs/TableApi.md#registerTable) | **POST** /RegisterTable | Register a table to a namespace *TableApi* | [**tableExists**](docs/TableApi.md#tableExists) | **POST** /TableExists | Check if a table exists @@ -133,8 +135,12 @@ Class | Method | HTTP request | Description - [AlterTransactionUnsetProperty](docs/AlterTransactionUnsetProperty.md) - [CreateNamespaceRequest](docs/CreateNamespaceRequest.md) - [CreateNamespaceResponse](docs/CreateNamespaceResponse.md) + - [DeregisterTableRequest](docs/DeregisterTableRequest.md) + - [DeregisterTableResponse](docs/DeregisterTableResponse.md) - [DropNamespaceRequest](docs/DropNamespaceRequest.md) - [DropNamespaceResponse](docs/DropNamespaceResponse.md) + - [DropTableRequest](docs/DropTableRequest.md) + - [DropTableResponse](docs/DropTableResponse.md) - [ErrorResponse](docs/ErrorResponse.md) - [GetNamespaceRequest](docs/GetNamespaceRequest.md) - [GetNamespaceResponse](docs/GetNamespaceResponse.md) diff --git a/java/lance-namespace-apache-client/api/openapi.yaml b/java/lance-namespace-apache-client/api/openapi.yaml index cf28e299e..9c669df55 100644 --- a/java/lance-namespace-apache-client/api/openapi.yaml +++ b/java/lance-namespace-apache-client/api/openapi.yaml @@ -365,6 +365,70 @@ paths: x-content-type: application/json x-accepts: - application/json + /DropTable: + post: + description: | + Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + operationId: DropTable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DropTableRequest' + required: true + responses: + "200": + $ref: '#/components/responses/DropTableResponse' + "400": + $ref: '#/components/responses/BadRequestErrorResponse' + "401": + $ref: '#/components/responses/UnauthorizedErrorResponse' + "403": + $ref: '#/components/responses/ForbiddenErrorResponse' + "404": + $ref: '#/components/responses/NotFoundErrorResponse' + "503": + $ref: '#/components/responses/ServiceUnavailableErrorResponse' + "5XX": + $ref: '#/components/responses/ServerErrorResponse' + summary: Drop a table from its namespace + tags: + - Table + x-content-type: application/json + x-accepts: + - application/json + /DeregisterTable: + post: + description: | + Deregister a table from its namespace. The table content remains available in the storage. + operationId: DeregisterTable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeregisterTableRequest' + required: true + responses: + "200": + $ref: '#/components/responses/DeregisterTableResponse' + "400": + $ref: '#/components/responses/BadRequestErrorResponse' + "401": + $ref: '#/components/responses/UnauthorizedErrorResponse' + "403": + $ref: '#/components/responses/ForbiddenErrorResponse' + "404": + $ref: '#/components/responses/NotFoundErrorResponse' + "503": + $ref: '#/components/responses/ServiceUnavailableErrorResponse' + "5XX": + $ref: '#/components/responses/ServerErrorResponse' + summary: Deregister a table from its namespace + tags: + - Table + x-content-type: application/json + x-accepts: + - application/json components: examples: ListNamespacesEmptyExample: @@ -444,6 +508,18 @@ components: schema: $ref: '#/components/schemas/AlterTransactionResponse' description: Response of AlterTransaction + DropTableResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/DropTableResponse' + description: Response of DropTable + DeregisterTableResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/DeregisterTableResponse' + description: Response of DeregisterTable BadRequestErrorResponse: content: application/json: @@ -1056,18 +1132,88 @@ components: AlterTransactionResponse: example: id: id - properties: - key: properties status: QUEUED properties: id: type: string status: $ref: '#/components/schemas/TransactionStatus' + required: + - id + - status + DropTableRequest: + example: + name: name + namespace: + - namespace + - namespace + properties: + name: + type: string + namespace: + items: + type: string + type: array + required: + - name + DropTableResponse: + example: + name: name + namespace: + - namespace + - namespace + location: location + properties: + key: properties + transactionId: transactionId + properties: + name: + type: string + namespace: + items: + type: string + type: array + location: + type: string properties: additionalProperties: type: string + transactionId: + type: string + DeregisterTableRequest: + example: + name: name + namespace: + - namespace + - namespace + properties: + name: + type: string + namespace: + items: + type: string + type: array required: - - id - - status + - name + DeregisterTableResponse: + example: + name: name + namespace: + - namespace + - namespace + location: location + properties: + key: properties + properties: + name: + type: string + namespace: + items: + type: string + type: array + location: + type: string + properties: + additionalProperties: + type: string diff --git a/java/lance-namespace-apache-client/docs/AlterTransactionResponse.md b/java/lance-namespace-apache-client/docs/AlterTransactionResponse.md index 94bd8e4e8..42a9ed146 100644 --- a/java/lance-namespace-apache-client/docs/AlterTransactionResponse.md +++ b/java/lance-namespace-apache-client/docs/AlterTransactionResponse.md @@ -9,7 +9,6 @@ |------------ | ------------- | ------------- | -------------| |**id** | **String** | | | |**status** | **TransactionStatus** | | | -|**properties** | **Map<String, String>** | | [optional] | diff --git a/java/lance-namespace-apache-client/docs/DeregisterTableRequest.md b/java/lance-namespace-apache-client/docs/DeregisterTableRequest.md new file mode 100644 index 000000000..356dfee0c --- /dev/null +++ b/java/lance-namespace-apache-client/docs/DeregisterTableRequest.md @@ -0,0 +1,14 @@ + + +# DeregisterTableRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**namespace** | **List<String>** | | [optional] | + + + diff --git a/java/lance-namespace-apache-client/docs/DeregisterTableResponse.md b/java/lance-namespace-apache-client/docs/DeregisterTableResponse.md new file mode 100644 index 000000000..5a24ec521 --- /dev/null +++ b/java/lance-namespace-apache-client/docs/DeregisterTableResponse.md @@ -0,0 +1,16 @@ + + +# DeregisterTableResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**namespace** | **List<String>** | | [optional] | +|**location** | **String** | | [optional] | +|**properties** | **Map<String, String>** | | [optional] | + + + diff --git a/java/lance-namespace-apache-client/docs/DropTableRequest.md b/java/lance-namespace-apache-client/docs/DropTableRequest.md new file mode 100644 index 000000000..7828570d6 --- /dev/null +++ b/java/lance-namespace-apache-client/docs/DropTableRequest.md @@ -0,0 +1,14 @@ + + +# DropTableRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**namespace** | **List<String>** | | [optional] | + + + diff --git a/java/lance-namespace-apache-client/docs/DropTableResponse.md b/java/lance-namespace-apache-client/docs/DropTableResponse.md new file mode 100644 index 000000000..8c5235a1e --- /dev/null +++ b/java/lance-namespace-apache-client/docs/DropTableResponse.md @@ -0,0 +1,17 @@ + + +# DropTableResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**namespace** | **List<String>** | | [optional] | +|**location** | **String** | | [optional] | +|**properties** | **Map<String, String>** | | [optional] | +|**transactionId** | **String** | | [optional] | + + + diff --git a/java/lance-namespace-apache-client/docs/TableApi.md b/java/lance-namespace-apache-client/docs/TableApi.md index da1f0ad63..1bc83ab10 100644 --- a/java/lance-namespace-apache-client/docs/TableApi.md +++ b/java/lance-namespace-apache-client/docs/TableApi.md @@ -4,12 +4,158 @@ All URIs are relative to *http://localhost:2333* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**deregisterTable**](TableApi.md#deregisterTable) | **POST** /DeregisterTable | Deregister a table from its namespace | +| [**dropTable**](TableApi.md#dropTable) | **POST** /DropTable | Drop a table from its namespace | | [**getTable**](TableApi.md#getTable) | **POST** /GetTable | Get a table from the namespace | | [**registerTable**](TableApi.md#registerTable) | **POST** /RegisterTable | Register a table to a namespace | | [**tableExists**](TableApi.md#tableExists) | **POST** /TableExists | Check if a table exists | +## deregisterTable + +> DeregisterTableResponse deregisterTable(deregisterTableRequest) + +Deregister a table from its namespace + +Deregister a table from its namespace. The table content remains available in the storage. + +### Example + +```java +// Import classes: +import com.lancedb.lance.namespace.client.apache.ApiClient; +import com.lancedb.lance.namespace.client.apache.ApiException; +import com.lancedb.lance.namespace.client.apache.Configuration; +import com.lancedb.lance.namespace.client.apache.models.*; +import com.lancedb.lance.namespace.client.apache.api.TableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:2333"); + + TableApi apiInstance = new TableApi(defaultClient); + DeregisterTableRequest deregisterTableRequest = new DeregisterTableRequest(); // DeregisterTableRequest | + try { + DeregisterTableResponse result = apiInstance.deregisterTable(deregisterTableRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TableApi#deregisterTable"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **deregisterTableRequest** | [**DeregisterTableRequest**](DeregisterTableRequest.md)| | | + +### Return type + +[**DeregisterTableResponse**](DeregisterTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Response of DeregisterTable | - | +| **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. | - | +| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - | +| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - | +| **404** | A server-side problem that means can not find the specified resource. | - | +| **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. | - | +| **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. | - | + + +## dropTable + +> DropTableResponse dropTable(dropTableRequest) + +Drop a table from its namespace + +Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + +### Example + +```java +// Import classes: +import com.lancedb.lance.namespace.client.apache.ApiClient; +import com.lancedb.lance.namespace.client.apache.ApiException; +import com.lancedb.lance.namespace.client.apache.Configuration; +import com.lancedb.lance.namespace.client.apache.models.*; +import com.lancedb.lance.namespace.client.apache.api.TableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:2333"); + + TableApi apiInstance = new TableApi(defaultClient); + DropTableRequest dropTableRequest = new DropTableRequest(); // DropTableRequest | + try { + DropTableResponse result = apiInstance.dropTable(dropTableRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TableApi#dropTable"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **dropTableRequest** | [**DropTableRequest**](DropTableRequest.md)| | | + +### Return type + +[**DropTableResponse**](DropTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Response of DropTable | - | +| **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. | - | +| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - | +| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - | +| **404** | A server-side problem that means can not find the specified resource. | - | +| **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. | - | +| **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. | - | + + ## getTable > GetTableResponse getTable(getTableRequest) diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/client/apache/api/TableApi.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/client/apache/api/TableApi.java index ae2ebc1df..a6fe7e168 100644 --- a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/client/apache/api/TableApi.java +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/client/apache/api/TableApi.java @@ -18,6 +18,10 @@ import com.lancedb.lance.namespace.client.apache.BaseApi; import com.lancedb.lance.namespace.client.apache.Configuration; import com.lancedb.lance.namespace.client.apache.Pair; +import com.lancedb.lance.namespace.model.DeregisterTableRequest; +import com.lancedb.lance.namespace.model.DeregisterTableResponse; +import com.lancedb.lance.namespace.model.DropTableRequest; +import com.lancedb.lance.namespace.model.DropTableResponse; import com.lancedb.lance.namespace.model.GetTableRequest; import com.lancedb.lance.namespace.model.GetTableResponse; import com.lancedb.lance.namespace.model.RegisterTableRequest; @@ -47,6 +51,151 @@ public TableApi(ApiClient apiClient) { super(apiClient); } + /** + * Deregister a table from its namespace Deregister a table from its namespace. The table content + * remains available in the storage. + * + * @param deregisterTableRequest (required) + * @return DeregisterTableResponse + * @throws ApiException if fails to make API call + */ + public DeregisterTableResponse deregisterTable(DeregisterTableRequest deregisterTableRequest) + throws ApiException { + return this.deregisterTable(deregisterTableRequest, Collections.emptyMap()); + } + + /** + * Deregister a table from its namespace Deregister a table from its namespace. The table content + * remains available in the storage. + * + * @param deregisterTableRequest (required) + * @param additionalHeaders additionalHeaders for this call + * @return DeregisterTableResponse + * @throws ApiException if fails to make API call + */ + public DeregisterTableResponse deregisterTable( + DeregisterTableRequest deregisterTableRequest, Map additionalHeaders) + throws ApiException { + Object localVarPostBody = deregisterTableRequest; + + // verify the required parameter 'deregisterTableRequest' is set + if (deregisterTableRequest == null) { + throw new ApiException( + 400, + "Missing the required parameter 'deregisterTableRequest' when calling deregisterTable"); + } + + // create path and map variables + String localVarPath = "/DeregisterTable"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Drop a table from its namespace Drop a table from its namespace and delete its data. If the + * table and its data can be immediately deleted, return information of the deleted table. + * Otherwise, return a transaction ID that client can use to track deletion progress. + * + * @param dropTableRequest (required) + * @return DropTableResponse + * @throws ApiException if fails to make API call + */ + public DropTableResponse dropTable(DropTableRequest dropTableRequest) throws ApiException { + return this.dropTable(dropTableRequest, Collections.emptyMap()); + } + + /** + * Drop a table from its namespace Drop a table from its namespace and delete its data. If the + * table and its data can be immediately deleted, return information of the deleted table. + * Otherwise, return a transaction ID that client can use to track deletion progress. + * + * @param dropTableRequest (required) + * @param additionalHeaders additionalHeaders for this call + * @return DropTableResponse + * @throws ApiException if fails to make API call + */ + public DropTableResponse dropTable( + DropTableRequest dropTableRequest, Map additionalHeaders) + throws ApiException { + Object localVarPostBody = dropTableRequest; + + // verify the required parameter 'dropTableRequest' is set + if (dropTableRequest == null) { + throw new ApiException( + 400, "Missing the required parameter 'dropTableRequest' when calling dropTable"); + } + + // create path and map variables + String localVarPath = "/DropTable"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + /** * Get a table from the namespace Get a table's detailed information under a specified * namespace. diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/AlterTransactionResponse.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/AlterTransactionResponse.java index 3a4f05259..c9d0af9d1 100644 --- a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/AlterTransactionResponse.java +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/AlterTransactionResponse.java @@ -19,16 +19,13 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; import java.util.StringJoiner; /** AlterTransactionResponse */ @JsonPropertyOrder({ AlterTransactionResponse.JSON_PROPERTY_ID, - AlterTransactionResponse.JSON_PROPERTY_STATUS, - AlterTransactionResponse.JSON_PROPERTY_PROPERTIES + AlterTransactionResponse.JSON_PROPERTY_STATUS }) @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", @@ -40,9 +37,6 @@ public class AlterTransactionResponse { public static final String JSON_PROPERTY_STATUS = "status"; @javax.annotation.Nonnull private TransactionStatus status; - public static final String JSON_PROPERTY_PROPERTIES = "properties"; - @javax.annotation.Nullable private Map properties = new HashMap<>(); - public AlterTransactionResponse() {} public AlterTransactionResponse id(@javax.annotation.Nonnull String id) { @@ -93,39 +87,6 @@ public void setStatus(@javax.annotation.Nonnull TransactionStatus status) { this.status = status; } - public AlterTransactionResponse properties( - @javax.annotation.Nullable Map properties) { - - this.properties = properties; - return this; - } - - public AlterTransactionResponse putPropertiesItem(String key, String propertiesItem) { - if (this.properties == null) { - this.properties = new HashMap<>(); - } - this.properties.put(key, propertiesItem); - return this; - } - - /** - * Get properties - * - * @return properties - */ - @javax.annotation.Nullable - @JsonProperty(JSON_PROPERTY_PROPERTIES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getProperties() { - return properties; - } - - @JsonProperty(JSON_PROPERTY_PROPERTIES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setProperties(@javax.annotation.Nullable Map properties) { - this.properties = properties; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -136,13 +97,12 @@ public boolean equals(Object o) { } AlterTransactionResponse alterTransactionResponse = (AlterTransactionResponse) o; return Objects.equals(this.id, alterTransactionResponse.id) - && Objects.equals(this.status, alterTransactionResponse.status) - && Objects.equals(this.properties, alterTransactionResponse.properties); + && Objects.equals(this.status, alterTransactionResponse.status); } @Override public int hashCode() { - return Objects.hash(id, status, properties); + return Objects.hash(id, status); } @Override @@ -151,7 +111,6 @@ public String toString() { sb.append("class AlterTransactionResponse {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -228,28 +187,6 @@ public String toUrlQueryString(String prefix) { } } - // add `properties` to the URL query string - if (getProperties() != null) { - for (String _key : getProperties().keySet()) { - try { - joiner.add( - String.format( - "%sproperties%s%s=%s", - prefix, - suffix, - "".equals(suffix) - ? "" - : String.format("%s%d%s", containerPrefix, _key, containerSuffix), - getProperties().get(_key), - URLEncoder.encode(String.valueOf(getProperties().get(_key)), "UTF-8") - .replaceAll("\\+", "%20"))); - } catch (UnsupportedEncodingException e) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - } - return joiner.toString(); } } diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableRequest.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableRequest.java new file mode 100644 index 000000000..c66df193c --- /dev/null +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableRequest.java @@ -0,0 +1,208 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** DeregisterTableRequest */ +@JsonPropertyOrder({ + DeregisterTableRequest.JSON_PROPERTY_NAME, + DeregisterTableRequest.JSON_PROPERTY_NAMESPACE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class DeregisterTableRequest { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull private String name; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + @javax.annotation.Nullable private List namespace = new ArrayList<>(); + + public DeregisterTableRequest() {} + + public DeregisterTableRequest name(@javax.annotation.Nonnull String name) { + + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public DeregisterTableRequest namespace(@javax.annotation.Nullable List namespace) { + + this.namespace = namespace; + return this; + } + + public DeregisterTableRequest addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespace() { + return namespace; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespace(@javax.annotation.Nullable List namespace) { + this.namespace = namespace; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeregisterTableRequest deregisterTableRequest = (DeregisterTableRequest) o; + return Objects.equals(this.name, deregisterTableRequest.name) + && Objects.equals(this.namespace, deregisterTableRequest.namespace); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeregisterTableRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + try { + joiner.add( + String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `namespace` to the URL query string + if (getNamespace() != null) { + for (int i = 0; i < getNamespace().size(); i++) { + try { + joiner.add( + String.format( + "%snamespace%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getNamespace().get(i)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + return joiner.toString(); + } +} diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableResponse.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableResponse.java new file mode 100644 index 000000000..1fc04d1cd --- /dev/null +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DeregisterTableResponse.java @@ -0,0 +1,317 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +/** DeregisterTableResponse */ +@JsonPropertyOrder({ + DeregisterTableResponse.JSON_PROPERTY_NAME, + DeregisterTableResponse.JSON_PROPERTY_NAMESPACE, + DeregisterTableResponse.JSON_PROPERTY_LOCATION, + DeregisterTableResponse.JSON_PROPERTY_PROPERTIES +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class DeregisterTableResponse { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable private String name; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + @javax.annotation.Nullable private List namespace = new ArrayList<>(); + + public static final String JSON_PROPERTY_LOCATION = "location"; + @javax.annotation.Nullable private String location; + + public static final String JSON_PROPERTY_PROPERTIES = "properties"; + @javax.annotation.Nullable private Map properties = new HashMap<>(); + + public DeregisterTableResponse() {} + + public DeregisterTableResponse name(@javax.annotation.Nullable String name) { + + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public DeregisterTableResponse namespace(@javax.annotation.Nullable List namespace) { + + this.namespace = namespace; + return this; + } + + public DeregisterTableResponse addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespace() { + return namespace; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespace(@javax.annotation.Nullable List namespace) { + this.namespace = namespace; + } + + public DeregisterTableResponse location(@javax.annotation.Nullable String location) { + + this.location = location; + return this; + } + + /** + * Get location + * + * @return location + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLocation() { + return location; + } + + @JsonProperty(JSON_PROPERTY_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLocation(@javax.annotation.Nullable String location) { + this.location = location; + } + + public DeregisterTableResponse properties( + @javax.annotation.Nullable Map properties) { + + this.properties = properties; + return this; + } + + public DeregisterTableResponse putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getProperties() { + return properties; + } + + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperties(@javax.annotation.Nullable Map properties) { + this.properties = properties; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeregisterTableResponse deregisterTableResponse = (DeregisterTableResponse) o; + return Objects.equals(this.name, deregisterTableResponse.name) + && Objects.equals(this.namespace, deregisterTableResponse.namespace) + && Objects.equals(this.location, deregisterTableResponse.location) + && Objects.equals(this.properties, deregisterTableResponse.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace, location, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeregisterTableResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + try { + joiner.add( + String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `namespace` to the URL query string + if (getNamespace() != null) { + for (int i = 0; i < getNamespace().size(); i++) { + try { + joiner.add( + String.format( + "%snamespace%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getNamespace().get(i)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + // add `location` to the URL query string + if (getLocation() != null) { + try { + joiner.add( + String.format( + "%slocation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getLocation()), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `properties` to the URL query string + if (getProperties() != null) { + for (String _key : getProperties().keySet()) { + try { + joiner.add( + String.format( + "%sproperties%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getProperties().get(_key), + URLEncoder.encode(String.valueOf(getProperties().get(_key)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + return joiner.toString(); + } +} diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableRequest.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableRequest.java new file mode 100644 index 000000000..4bf323670 --- /dev/null +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableRequest.java @@ -0,0 +1,205 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** DropTableRequest */ +@JsonPropertyOrder({DropTableRequest.JSON_PROPERTY_NAME, DropTableRequest.JSON_PROPERTY_NAMESPACE}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class DropTableRequest { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull private String name; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + @javax.annotation.Nullable private List namespace = new ArrayList<>(); + + public DropTableRequest() {} + + public DropTableRequest name(@javax.annotation.Nonnull String name) { + + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public DropTableRequest namespace(@javax.annotation.Nullable List namespace) { + + this.namespace = namespace; + return this; + } + + public DropTableRequest addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespace() { + return namespace; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespace(@javax.annotation.Nullable List namespace) { + this.namespace = namespace; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DropTableRequest dropTableRequest = (DropTableRequest) o; + return Objects.equals(this.name, dropTableRequest.name) + && Objects.equals(this.namespace, dropTableRequest.namespace); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DropTableRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + try { + joiner.add( + String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `namespace` to the URL query string + if (getNamespace() != null) { + for (int i = 0; i < getNamespace().size(); i++) { + try { + joiner.add( + String.format( + "%snamespace%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getNamespace().get(i)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + return joiner.toString(); + } +} diff --git a/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableResponse.java b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableResponse.java new file mode 100644 index 000000000..2d864671f --- /dev/null +++ b/java/lance-namespace-apache-client/src/main/java/com/lancedb/lance/namespace/model/DropTableResponse.java @@ -0,0 +1,362 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +/** DropTableResponse */ +@JsonPropertyOrder({ + DropTableResponse.JSON_PROPERTY_NAME, + DropTableResponse.JSON_PROPERTY_NAMESPACE, + DropTableResponse.JSON_PROPERTY_LOCATION, + DropTableResponse.JSON_PROPERTY_PROPERTIES, + DropTableResponse.JSON_PROPERTY_TRANSACTION_ID +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class DropTableResponse { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable private String name; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + @javax.annotation.Nullable private List namespace = new ArrayList<>(); + + public static final String JSON_PROPERTY_LOCATION = "location"; + @javax.annotation.Nullable private String location; + + public static final String JSON_PROPERTY_PROPERTIES = "properties"; + @javax.annotation.Nullable private Map properties = new HashMap<>(); + + public static final String JSON_PROPERTY_TRANSACTION_ID = "transactionId"; + @javax.annotation.Nullable private String transactionId; + + public DropTableResponse() {} + + public DropTableResponse name(@javax.annotation.Nullable String name) { + + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public DropTableResponse namespace(@javax.annotation.Nullable List namespace) { + + this.namespace = namespace; + return this; + } + + public DropTableResponse addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespace() { + return namespace; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespace(@javax.annotation.Nullable List namespace) { + this.namespace = namespace; + } + + public DropTableResponse location(@javax.annotation.Nullable String location) { + + this.location = location; + return this; + } + + /** + * Get location + * + * @return location + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLocation() { + return location; + } + + @JsonProperty(JSON_PROPERTY_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLocation(@javax.annotation.Nullable String location) { + this.location = location; + } + + public DropTableResponse properties(@javax.annotation.Nullable Map properties) { + + this.properties = properties; + return this; + } + + public DropTableResponse putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getProperties() { + return properties; + } + + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperties(@javax.annotation.Nullable Map properties) { + this.properties = properties; + } + + public DropTableResponse transactionId(@javax.annotation.Nullable String transactionId) { + + this.transactionId = transactionId; + return this; + } + + /** + * Get transactionId + * + * @return transactionId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TRANSACTION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTransactionId() { + return transactionId; + } + + @JsonProperty(JSON_PROPERTY_TRANSACTION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTransactionId(@javax.annotation.Nullable String transactionId) { + this.transactionId = transactionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DropTableResponse dropTableResponse = (DropTableResponse) o; + return Objects.equals(this.name, dropTableResponse.name) + && Objects.equals(this.namespace, dropTableResponse.namespace) + && Objects.equals(this.location, dropTableResponse.location) + && Objects.equals(this.properties, dropTableResponse.properties) + && Objects.equals(this.transactionId, dropTableResponse.transactionId); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace, location, properties, transactionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DropTableResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + try { + joiner.add( + String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `namespace` to the URL query string + if (getNamespace() != null) { + for (int i = 0; i < getNamespace().size(); i++) { + try { + joiner.add( + String.format( + "%snamespace%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getNamespace().get(i)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + // add `location` to the URL query string + if (getLocation() != null) { + try { + joiner.add( + String.format( + "%slocation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getLocation()), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `properties` to the URL query string + if (getProperties() != null) { + for (String _key : getProperties().keySet()) { + try { + joiner.add( + String.format( + "%sproperties%s%s=%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getProperties().get(_key), + URLEncoder.encode(String.valueOf(getProperties().get(_key)), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + // add `transactionId` to the URL query string + if (getTransactionId() != null) { + try { + joiner.add( + String.format( + "%stransactionId%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTransactionId()), "UTF-8") + .replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + return joiner.toString(); + } +} diff --git a/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceNamespace.java b/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceNamespace.java index 3b470588b..f189f41c6 100644 --- a/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceNamespace.java +++ b/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceNamespace.java @@ -17,8 +17,12 @@ import com.lancedb.lance.namespace.model.AlterTransactionResponse; import com.lancedb.lance.namespace.model.CreateNamespaceRequest; import com.lancedb.lance.namespace.model.CreateNamespaceResponse; +import com.lancedb.lance.namespace.model.DeregisterTableRequest; +import com.lancedb.lance.namespace.model.DeregisterTableResponse; import com.lancedb.lance.namespace.model.DropNamespaceRequest; import com.lancedb.lance.namespace.model.DropNamespaceResponse; +import com.lancedb.lance.namespace.model.DropTableRequest; +import com.lancedb.lance.namespace.model.DropTableResponse; import com.lancedb.lance.namespace.model.GetNamespaceRequest; import com.lancedb.lance.namespace.model.GetNamespaceResponse; import com.lancedb.lance.namespace.model.GetTableRequest; @@ -53,6 +57,10 @@ public interface LanceNamespace { TableExistsResponse tableExists(TableExistsRequest request); + DropTableResponse dropTable(DropTableRequest request); + + DeregisterTableResponse deregisterTable(DeregisterTableRequest request); + GetTransactionResponse getTransaction(GetTransactionRequest request); AlterTransactionResponse alterTransaction(AlterTransactionRequest request); diff --git a/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceRestNamespace.java b/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceRestNamespace.java index 55d27b443..7d677cc9b 100644 --- a/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceRestNamespace.java +++ b/java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/LanceRestNamespace.java @@ -22,8 +22,12 @@ import com.lancedb.lance.namespace.model.AlterTransactionResponse; import com.lancedb.lance.namespace.model.CreateNamespaceRequest; import com.lancedb.lance.namespace.model.CreateNamespaceResponse; +import com.lancedb.lance.namespace.model.DeregisterTableRequest; +import com.lancedb.lance.namespace.model.DeregisterTableResponse; import com.lancedb.lance.namespace.model.DropNamespaceRequest; import com.lancedb.lance.namespace.model.DropNamespaceResponse; +import com.lancedb.lance.namespace.model.DropTableRequest; +import com.lancedb.lance.namespace.model.DropTableResponse; import com.lancedb.lance.namespace.model.GetNamespaceRequest; import com.lancedb.lance.namespace.model.GetNamespaceResponse; import com.lancedb.lance.namespace.model.GetTableRequest; @@ -124,6 +128,24 @@ public TableExistsResponse tableExists(TableExistsRequest request) { } } + @Override + public DeregisterTableResponse deregisterTable(DeregisterTableRequest request) { + try { + return tableApi.deregisterTable(request); + } catch (ApiException e) { + throw new LanceNamespaceException(e); + } + } + + @Override + public DropTableResponse dropTable(DropTableRequest request) { + try { + return tableApi.dropTable(request); + } catch (ApiException e) { + throw new LanceNamespaceException(e); + } + } + @Override public AlterTransactionResponse alterTransaction(AlterTransactionRequest request) { try { diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TableApi.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TableApi.java index a71ddff6b..0f07296a1 100644 --- a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TableApi.java +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TableApi.java @@ -13,6 +13,10 @@ */ package com.lancedb.lance.namespace.server.springboot.api; +import com.lancedb.lance.namespace.server.springboot.model.DeregisterTableRequest; +import com.lancedb.lance.namespace.server.springboot.model.DeregisterTableResponse; +import com.lancedb.lance.namespace.server.springboot.model.DropTableRequest; +import com.lancedb.lance.namespace.server.springboot.model.DropTableResponse; import com.lancedb.lance.namespace.server.springboot.model.ErrorResponse; import com.lancedb.lance.namespace.server.springboot.model.GetTableRequest; import com.lancedb.lance.namespace.server.springboot.model.GetTableResponse; @@ -51,6 +55,300 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /DeregisterTable : Deregister a table from its namespace Deregister a table from its + * namespace. The table content remains available in the storage. + * + * @param deregisterTableRequest (required) + * @return Response of DeregisterTable (status code 200) or 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. (status + * code 400) or Unauthorized. The request lacks valid authentication credentials for the + * operation. (status code 401) or Forbidden. Authenticated user does not have the necessary + * permissions. (status code 403) or A server-side problem that means can not find the + * specified resource. (status code 404) or 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. (status code 503) or 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. (status code 5XX) + */ + @Operation( + operationId = "deregisterTable", + summary = "Deregister a table from its namespace", + description = + "Deregister a table from its namespace. The table content remains available in the storage. ", + tags = {"Table"}, + responses = { + @ApiResponse( + responseCode = "200", + description = "Response of DeregisterTable", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = DeregisterTableResponse.class)) + }), + @ApiResponse( + responseCode = "400", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "401", + description = + "Unauthorized. The request lacks valid authentication credentials for the operation.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "403", + description = "Forbidden. Authenticated user does not have the necessary permissions.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "404", + description = "A server-side problem that means can not find the specified resource.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "503", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "5XX", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/DeregisterTable", + produces = {"application/json"}, + consumes = {"application/json"}) + default ResponseEntity deregisterTable( + @Parameter(name = "DeregisterTableRequest", description = "", required = true) + @Valid + @RequestBody + DeregisterTableRequest deregisterTableRequest) { + getRequest() + .ifPresent( + request -> { + for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"name\" : \"name\", \"namespace\" : [ \"namespace\", \"namespace\" ], \"location\" : \"location\", \"properties\" : { \"key\" : \"properties\" } }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + + /** + * POST /DropTable : Drop a table from its namespace Drop a table from its namespace and delete + * its data. If the table and its data can be immediately deleted, return information of the + * deleted table. Otherwise, return a transaction ID that client can use to track deletion + * progress. + * + * @param dropTableRequest (required) + * @return Response of DropTable (status code 200) or 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. (status code + * 400) or Unauthorized. The request lacks valid authentication credentials for the operation. + * (status code 401) or Forbidden. Authenticated user does not have the necessary permissions. + * (status code 403) or A server-side problem that means can not find the specified resource. + * (status code 404) or 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. (status code 503) or 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. (status code 5XX) + */ + @Operation( + operationId = "dropTable", + summary = "Drop a table from its namespace", + description = + "Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. ", + tags = {"Table"}, + responses = { + @ApiResponse( + responseCode = "200", + description = "Response of DropTable", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = DropTableResponse.class)) + }), + @ApiResponse( + responseCode = "400", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "401", + description = + "Unauthorized. The request lacks valid authentication credentials for the operation.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "403", + description = "Forbidden. Authenticated user does not have the necessary permissions.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "404", + description = "A server-side problem that means can not find the specified resource.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "503", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse( + responseCode = "5XX", + description = + "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.", + content = { + @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)) + }) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/DropTable", + produces = {"application/json"}, + consumes = {"application/json"}) + default ResponseEntity dropTable( + @Parameter(name = "DropTableRequest", description = "", required = true) @Valid @RequestBody + DropTableRequest dropTableRequest) { + getRequest() + .ifPresent( + request -> { + for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"name\" : \"name\", \"namespace\" : [ \"namespace\", \"namespace\" ], \"location\" : \"location\", \"properties\" : { \"key\" : \"properties\" }, \"transactionId\" : \"transactionId\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = + "{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + /** * POST /GetTable : Get a table from the namespace Get a table's detailed information under a * specified namespace. diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TransactionApi.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TransactionApi.java index 4551c4042..cd48ca61f 100644 --- a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TransactionApi.java +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/api/TransactionApi.java @@ -156,8 +156,7 @@ default ResponseEntity alterTransaction( request -> { for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = - "{ \"id\" : \"id\", \"properties\" : { \"key\" : \"properties\" }, \"status\" : \"QUEUED\" }"; + String exampleString = "{ \"id\" : \"id\", \"status\" : \"QUEUED\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/AlterTransactionResponse.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/AlterTransactionResponse.java index 2a7b90375..b536bf3d5 100644 --- a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/AlterTransactionResponse.java +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/AlterTransactionResponse.java @@ -21,8 +21,6 @@ import javax.validation.constraints.*; import java.util.*; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; /** AlterTransactionResponse */ @@ -35,8 +33,6 @@ public class AlterTransactionResponse { private TransactionStatus status; - @Valid private Map properties = new HashMap<>(); - public AlterTransactionResponse() { super(); } @@ -90,34 +86,6 @@ public void setStatus(TransactionStatus status) { this.status = status; } - public AlterTransactionResponse properties(Map properties) { - this.properties = properties; - return this; - } - - public AlterTransactionResponse putPropertiesItem(String key, String propertiesItem) { - if (this.properties == null) { - this.properties = new HashMap<>(); - } - this.properties.put(key, propertiesItem); - return this; - } - - /** - * Get properties - * - * @return properties - */ - @Schema(name = "properties", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonProperty("properties") - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -128,13 +96,12 @@ public boolean equals(Object o) { } AlterTransactionResponse alterTransactionResponse = (AlterTransactionResponse) o; return Objects.equals(this.id, alterTransactionResponse.id) - && Objects.equals(this.status, alterTransactionResponse.status) - && Objects.equals(this.properties, alterTransactionResponse.properties); + && Objects.equals(this.status, alterTransactionResponse.status); } @Override public int hashCode() { - return Objects.hash(id, status, properties); + return Objects.hash(id, status); } @Override @@ -143,7 +110,6 @@ public String toString() { sb.append("class AlterTransactionResponse {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableRequest.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableRequest.java new file mode 100644 index 000000000..9767bcba5 --- /dev/null +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableRequest.java @@ -0,0 +1,133 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.server.springboot.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.annotation.Generated; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** DeregisterTableRequest */ +@Generated( + value = "org.openapitools.codegen.languages.SpringCodegen", + comments = "Generator version: 7.12.0") +public class DeregisterTableRequest { + + private String name; + + @Valid private List namespace = new ArrayList<>(); + + public DeregisterTableRequest() { + super(); + } + + /** Constructor with only required parameters */ + public DeregisterTableRequest(String name) { + this.name = name; + } + + public DeregisterTableRequest name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DeregisterTableRequest namespace(List namespace) { + this.namespace = namespace; + return this; + } + + public DeregisterTableRequest addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @Schema(name = "namespace", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("namespace") + public List getNamespace() { + return namespace; + } + + public void setNamespace(List namespace) { + this.namespace = namespace; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeregisterTableRequest deregisterTableRequest = (DeregisterTableRequest) o; + return Objects.equals(this.name, deregisterTableRequest.name) + && Objects.equals(this.namespace, deregisterTableRequest.namespace); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeregisterTableRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableResponse.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableResponse.java new file mode 100644 index 000000000..0a40a3948 --- /dev/null +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DeregisterTableResponse.java @@ -0,0 +1,181 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.server.springboot.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.annotation.Generated; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** DeregisterTableResponse */ +@Generated( + value = "org.openapitools.codegen.languages.SpringCodegen", + comments = "Generator version: 7.12.0") +public class DeregisterTableResponse { + + private String name; + + @Valid private List namespace = new ArrayList<>(); + + private String location; + + @Valid private Map properties = new HashMap<>(); + + public DeregisterTableResponse name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DeregisterTableResponse namespace(List namespace) { + this.namespace = namespace; + return this; + } + + public DeregisterTableResponse addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @Schema(name = "namespace", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("namespace") + public List getNamespace() { + return namespace; + } + + public void setNamespace(List namespace) { + this.namespace = namespace; + } + + public DeregisterTableResponse location(String location) { + this.location = location; + return this; + } + + /** + * Get location + * + * @return location + */ + @Schema(name = "location", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("location") + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public DeregisterTableResponse properties(Map properties) { + this.properties = properties; + return this; + } + + public DeregisterTableResponse putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + */ + @Schema(name = "properties", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("properties") + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeregisterTableResponse deregisterTableResponse = (DeregisterTableResponse) o; + return Objects.equals(this.name, deregisterTableResponse.name) + && Objects.equals(this.namespace, deregisterTableResponse.namespace) + && Objects.equals(this.location, deregisterTableResponse.location) + && Objects.equals(this.properties, deregisterTableResponse.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace, location, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeregisterTableResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableRequest.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableRequest.java new file mode 100644 index 000000000..54929bbba --- /dev/null +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableRequest.java @@ -0,0 +1,133 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.server.springboot.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.annotation.Generated; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** DropTableRequest */ +@Generated( + value = "org.openapitools.codegen.languages.SpringCodegen", + comments = "Generator version: 7.12.0") +public class DropTableRequest { + + private String name; + + @Valid private List namespace = new ArrayList<>(); + + public DropTableRequest() { + super(); + } + + /** Constructor with only required parameters */ + public DropTableRequest(String name) { + this.name = name; + } + + public DropTableRequest name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DropTableRequest namespace(List namespace) { + this.namespace = namespace; + return this; + } + + public DropTableRequest addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @Schema(name = "namespace", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("namespace") + public List getNamespace() { + return namespace; + } + + public void setNamespace(List namespace) { + this.namespace = namespace; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DropTableRequest dropTableRequest = (DropTableRequest) o; + return Objects.equals(this.name, dropTableRequest.name) + && Objects.equals(this.namespace, dropTableRequest.namespace); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DropTableRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableResponse.java b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableResponse.java new file mode 100644 index 000000000..cbbc4a232 --- /dev/null +++ b/java/lance-namespace-springboot-server/src/main/java/com/lancedb/lance/namespace/server/springboot/model/DropTableResponse.java @@ -0,0 +1,205 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.lancedb.lance.namespace.server.springboot.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.annotation.Generated; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** DropTableResponse */ +@Generated( + value = "org.openapitools.codegen.languages.SpringCodegen", + comments = "Generator version: 7.12.0") +public class DropTableResponse { + + private String name; + + @Valid private List namespace = new ArrayList<>(); + + private String location; + + @Valid private Map properties = new HashMap<>(); + + private String transactionId; + + public DropTableResponse name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DropTableResponse namespace(List namespace) { + this.namespace = namespace; + return this; + } + + public DropTableResponse addNamespaceItem(String namespaceItem) { + if (this.namespace == null) { + this.namespace = new ArrayList<>(); + } + this.namespace.add(namespaceItem); + return this; + } + + /** + * Get namespace + * + * @return namespace + */ + @Schema(name = "namespace", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("namespace") + public List getNamespace() { + return namespace; + } + + public void setNamespace(List namespace) { + this.namespace = namespace; + } + + public DropTableResponse location(String location) { + this.location = location; + return this; + } + + /** + * Get location + * + * @return location + */ + @Schema(name = "location", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("location") + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public DropTableResponse properties(Map properties) { + this.properties = properties; + return this; + } + + public DropTableResponse putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + */ + @Schema(name = "properties", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("properties") + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + public DropTableResponse transactionId(String transactionId) { + this.transactionId = transactionId; + return this; + } + + /** + * Get transactionId + * + * @return transactionId + */ + @Schema(name = "transactionId", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("transactionId") + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DropTableResponse dropTableResponse = (DropTableResponse) o; + return Objects.equals(this.name, dropTableResponse.name) + && Objects.equals(this.namespace, dropTableResponse.namespace) + && Objects.equals(this.location, dropTableResponse.location) + && Objects.equals(this.properties, dropTableResponse.properties) + && Objects.equals(this.transactionId, dropTableResponse.transactionId); + } + + @Override + public int hashCode() { + return Objects.hash(name, namespace, location, properties, transactionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DropTableResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/python/lance_namespace_urllib3_client/README.md b/python/lance_namespace_urllib3_client/README.md index 93675ac4d..d69f884fe 100644 --- a/python/lance_namespace_urllib3_client/README.md +++ b/python/lance_namespace_urllib3_client/README.md @@ -93,6 +93,8 @@ Class | Method | HTTP request | Description *NamespaceApi* | [**get_namespace**](docs/NamespaceApi.md#get_namespace) | **POST** /GetNamespace | Get information about a namespace *NamespaceApi* | [**list_namespaces**](docs/NamespaceApi.md#list_namespaces) | **POST** /ListNamespaces | List namespaces *NamespaceApi* | [**namespace_exists**](docs/NamespaceApi.md#namespace_exists) | **POST** /NamespaceExists | Check if a namespace exists +*TableApi* | [**deregister_table**](docs/TableApi.md#deregister_table) | **POST** /DeregisterTable | Deregister a table from its namespace +*TableApi* | [**drop_table**](docs/TableApi.md#drop_table) | **POST** /DropTable | Drop a table from its namespace *TableApi* | [**get_table**](docs/TableApi.md#get_table) | **POST** /GetTable | Get a table from the namespace *TableApi* | [**register_table**](docs/TableApi.md#register_table) | **POST** /RegisterTable | Register a table to a namespace *TableApi* | [**table_exists**](docs/TableApi.md#table_exists) | **POST** /TableExists | Check if a table exists @@ -110,8 +112,12 @@ Class | Method | HTTP request | Description - [AlterTransactionUnsetProperty](docs/AlterTransactionUnsetProperty.md) - [CreateNamespaceRequest](docs/CreateNamespaceRequest.md) - [CreateNamespaceResponse](docs/CreateNamespaceResponse.md) + - [DeregisterTableRequest](docs/DeregisterTableRequest.md) + - [DeregisterTableResponse](docs/DeregisterTableResponse.md) - [DropNamespaceRequest](docs/DropNamespaceRequest.md) - [DropNamespaceResponse](docs/DropNamespaceResponse.md) + - [DropTableRequest](docs/DropTableRequest.md) + - [DropTableResponse](docs/DropTableResponse.md) - [ErrorResponse](docs/ErrorResponse.md) - [GetNamespaceRequest](docs/GetNamespaceRequest.md) - [GetNamespaceResponse](docs/GetNamespaceResponse.md) diff --git a/python/lance_namespace_urllib3_client/docs/AlterTransactionResponse.md b/python/lance_namespace_urllib3_client/docs/AlterTransactionResponse.md index 10e0cbe77..dc70375f5 100644 --- a/python/lance_namespace_urllib3_client/docs/AlterTransactionResponse.md +++ b/python/lance_namespace_urllib3_client/docs/AlterTransactionResponse.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | **status** | [**TransactionStatus**](TransactionStatus.md) | | -**properties** | **Dict[str, str]** | | [optional] ## Example diff --git a/python/lance_namespace_urllib3_client/docs/DeregisterTableRequest.md b/python/lance_namespace_urllib3_client/docs/DeregisterTableRequest.md new file mode 100644 index 000000000..76f30b892 --- /dev/null +++ b/python/lance_namespace_urllib3_client/docs/DeregisterTableRequest.md @@ -0,0 +1,30 @@ +# DeregisterTableRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**namespace** | **List[str]** | | [optional] + +## Example + +```python +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of DeregisterTableRequest from a JSON string +deregister_table_request_instance = DeregisterTableRequest.from_json(json) +# print the JSON string representation of the object +print(DeregisterTableRequest.to_json()) + +# convert the object into a dict +deregister_table_request_dict = deregister_table_request_instance.to_dict() +# create an instance of DeregisterTableRequest from a dict +deregister_table_request_from_dict = DeregisterTableRequest.from_dict(deregister_table_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/python/lance_namespace_urllib3_client/docs/DeregisterTableResponse.md b/python/lance_namespace_urllib3_client/docs/DeregisterTableResponse.md new file mode 100644 index 000000000..437fda445 --- /dev/null +++ b/python/lance_namespace_urllib3_client/docs/DeregisterTableResponse.md @@ -0,0 +1,32 @@ +# DeregisterTableResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] +**namespace** | **List[str]** | | [optional] +**location** | **str** | | [optional] +**properties** | **Dict[str, str]** | | [optional] + +## Example + +```python +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DeregisterTableResponse from a JSON string +deregister_table_response_instance = DeregisterTableResponse.from_json(json) +# print the JSON string representation of the object +print(DeregisterTableResponse.to_json()) + +# convert the object into a dict +deregister_table_response_dict = deregister_table_response_instance.to_dict() +# create an instance of DeregisterTableResponse from a dict +deregister_table_response_from_dict = DeregisterTableResponse.from_dict(deregister_table_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/python/lance_namespace_urllib3_client/docs/DropTableRequest.md b/python/lance_namespace_urllib3_client/docs/DropTableRequest.md new file mode 100644 index 000000000..4088186fc --- /dev/null +++ b/python/lance_namespace_urllib3_client/docs/DropTableRequest.md @@ -0,0 +1,30 @@ +# DropTableRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**namespace** | **List[str]** | | [optional] + +## Example + +```python +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of DropTableRequest from a JSON string +drop_table_request_instance = DropTableRequest.from_json(json) +# print the JSON string representation of the object +print(DropTableRequest.to_json()) + +# convert the object into a dict +drop_table_request_dict = drop_table_request_instance.to_dict() +# create an instance of DropTableRequest from a dict +drop_table_request_from_dict = DropTableRequest.from_dict(drop_table_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/python/lance_namespace_urllib3_client/docs/DropTableResponse.md b/python/lance_namespace_urllib3_client/docs/DropTableResponse.md new file mode 100644 index 000000000..004811798 --- /dev/null +++ b/python/lance_namespace_urllib3_client/docs/DropTableResponse.md @@ -0,0 +1,33 @@ +# DropTableResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] +**namespace** | **List[str]** | | [optional] +**location** | **str** | | [optional] +**properties** | **Dict[str, str]** | | [optional] +**transaction_id** | **str** | | [optional] + +## Example + +```python +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DropTableResponse from a JSON string +drop_table_response_instance = DropTableResponse.from_json(json) +# print the JSON string representation of the object +print(DropTableResponse.to_json()) + +# convert the object into a dict +drop_table_response_dict = drop_table_response_instance.to_dict() +# create an instance of DropTableResponse from a dict +drop_table_response_from_dict = DropTableResponse.from_dict(drop_table_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/python/lance_namespace_urllib3_client/docs/TableApi.md b/python/lance_namespace_urllib3_client/docs/TableApi.md index b4e7cbf2e..8191cd18a 100644 --- a/python/lance_namespace_urllib3_client/docs/TableApi.md +++ b/python/lance_namespace_urllib3_client/docs/TableApi.md @@ -4,11 +4,165 @@ All URIs are relative to *http://localhost:2333* Method | HTTP request | Description ------------- | ------------- | ------------- +[**deregister_table**](TableApi.md#deregister_table) | **POST** /DeregisterTable | Deregister a table from its namespace +[**drop_table**](TableApi.md#drop_table) | **POST** /DropTable | Drop a table from its namespace [**get_table**](TableApi.md#get_table) | **POST** /GetTable | Get a table from the namespace [**register_table**](TableApi.md#register_table) | **POST** /RegisterTable | Register a table to a namespace [**table_exists**](TableApi.md#table_exists) | **POST** /TableExists | Check if a table exists +# **deregister_table** +> DeregisterTableResponse deregister_table(deregister_table_request) + +Deregister a table from its namespace + +Deregister a table from its namespace. The table content remains available in the storage. + + +### Example + + +```python +import lance_namespace_urllib3_client +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse +from lance_namespace_urllib3_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:2333 +# See configuration.py for a list of all supported configuration parameters. +configuration = lance_namespace_urllib3_client.Configuration( + host = "http://localhost:2333" +) + + +# Enter a context with an instance of the API client +with lance_namespace_urllib3_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lance_namespace_urllib3_client.TableApi(api_client) + deregister_table_request = lance_namespace_urllib3_client.DeregisterTableRequest() # DeregisterTableRequest | + + try: + # Deregister a table from its namespace + api_response = api_instance.deregister_table(deregister_table_request) + print("The response of TableApi->deregister_table:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TableApi->deregister_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **deregister_table_request** | [**DeregisterTableRequest**](DeregisterTableRequest.md)| | + +### Return type + +[**DeregisterTableResponse**](DeregisterTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Response of DeregisterTable | - | +**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. | - | +**401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - | +**403** | Forbidden. Authenticated user does not have the necessary permissions. | - | +**404** | A server-side problem that means can not find the specified resource. | - | +**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. | - | +**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. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **drop_table** +> DropTableResponse drop_table(drop_table_request) + +Drop a table from its namespace + +Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + + +### Example + + +```python +import lance_namespace_urllib3_client +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse +from lance_namespace_urllib3_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:2333 +# See configuration.py for a list of all supported configuration parameters. +configuration = lance_namespace_urllib3_client.Configuration( + host = "http://localhost:2333" +) + + +# Enter a context with an instance of the API client +with lance_namespace_urllib3_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lance_namespace_urllib3_client.TableApi(api_client) + drop_table_request = lance_namespace_urllib3_client.DropTableRequest() # DropTableRequest | + + try: + # Drop a table from its namespace + api_response = api_instance.drop_table(drop_table_request) + print("The response of TableApi->drop_table:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TableApi->drop_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **drop_table_request** | [**DropTableRequest**](DropTableRequest.md)| | + +### Return type + +[**DropTableResponse**](DropTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Response of DropTable | - | +**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. | - | +**401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - | +**403** | Forbidden. Authenticated user does not have the necessary permissions. | - | +**404** | A server-side problem that means can not find the specified resource. | - | +**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. | - | +**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. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_table** > GetTableResponse get_table(get_table_request) diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/__init__.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/__init__.py index 83475088a..927618d7e 100644 --- a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/__init__.py +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/__init__.py @@ -41,8 +41,12 @@ from lance_namespace_urllib3_client.models.alter_transaction_unset_property import AlterTransactionUnsetProperty from lance_namespace_urllib3_client.models.create_namespace_request import CreateNamespaceRequest from lance_namespace_urllib3_client.models.create_namespace_response import CreateNamespaceResponse +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse from lance_namespace_urllib3_client.models.drop_namespace_request import DropNamespaceRequest from lance_namespace_urllib3_client.models.drop_namespace_response import DropNamespaceResponse +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse from lance_namespace_urllib3_client.models.error_response import ErrorResponse from lance_namespace_urllib3_client.models.get_namespace_request import GetNamespaceRequest from lance_namespace_urllib3_client.models.get_namespace_response import GetNamespaceResponse diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/api/table_api.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/api/table_api.py index ae390c648..6892a8cdd 100644 --- a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/api/table_api.py +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/api/table_api.py @@ -16,6 +16,10 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse from lance_namespace_urllib3_client.models.get_table_request import GetTableRequest from lance_namespace_urllib3_client.models.get_table_response import GetTableResponse from lance_namespace_urllib3_client.models.register_table_request import RegisterTableRequest @@ -41,6 +45,588 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def deregister_table( + self, + deregister_table_request: DeregisterTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeregisterTableResponse: + """Deregister a table from its namespace + + Deregister a table from its namespace. The table content remains available in the storage. + + :param deregister_table_request: (required) + :type deregister_table_request: DeregisterTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._deregister_table_serialize( + deregister_table_request=deregister_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeregisterTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def deregister_table_with_http_info( + self, + deregister_table_request: DeregisterTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeregisterTableResponse]: + """Deregister a table from its namespace + + Deregister a table from its namespace. The table content remains available in the storage. + + :param deregister_table_request: (required) + :type deregister_table_request: DeregisterTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._deregister_table_serialize( + deregister_table_request=deregister_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeregisterTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def deregister_table_without_preload_content( + self, + deregister_table_request: DeregisterTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deregister a table from its namespace + + Deregister a table from its namespace. The table content remains available in the storage. + + :param deregister_table_request: (required) + :type deregister_table_request: DeregisterTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._deregister_table_serialize( + deregister_table_request=deregister_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeregisterTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _deregister_table_serialize( + self, + deregister_table_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if deregister_table_request is not None: + _body_params = deregister_table_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/DeregisterTable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def drop_table( + self, + drop_table_request: DropTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DropTableResponse: + """Drop a table from its namespace + + Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + + :param drop_table_request: (required) + :type drop_table_request: DropTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._drop_table_serialize( + drop_table_request=drop_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DropTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def drop_table_with_http_info( + self, + drop_table_request: DropTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DropTableResponse]: + """Drop a table from its namespace + + Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + + :param drop_table_request: (required) + :type drop_table_request: DropTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._drop_table_serialize( + drop_table_request=drop_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DropTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def drop_table_without_preload_content( + self, + drop_table_request: DropTableRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Drop a table from its namespace + + Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + + :param drop_table_request: (required) + :type drop_table_request: DropTableRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._drop_table_serialize( + drop_table_request=drop_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DropTableResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '503': "ErrorResponse", + '5XX': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _drop_table_serialize( + self, + drop_table_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if drop_table_request is not None: + _body_params = drop_table_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/DropTable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def get_table( self, diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/__init__.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/__init__.py index ecb272608..8e3bb9390 100644 --- a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/__init__.py +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/__init__.py @@ -22,8 +22,12 @@ from lance_namespace_urllib3_client.models.alter_transaction_unset_property import AlterTransactionUnsetProperty from lance_namespace_urllib3_client.models.create_namespace_request import CreateNamespaceRequest from lance_namespace_urllib3_client.models.create_namespace_response import CreateNamespaceResponse +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse from lance_namespace_urllib3_client.models.drop_namespace_request import DropNamespaceRequest from lance_namespace_urllib3_client.models.drop_namespace_response import DropNamespaceResponse +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse from lance_namespace_urllib3_client.models.error_response import ErrorResponse from lance_namespace_urllib3_client.models.get_namespace_request import GetNamespaceRequest from lance_namespace_urllib3_client.models.get_namespace_response import GetNamespaceResponse diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/alter_transaction_response.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/alter_transaction_response.py index e16c3dbd2..78ab920dc 100644 --- a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/alter_transaction_response.py +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/alter_transaction_response.py @@ -18,7 +18,7 @@ import json from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from lance_namespace_urllib3_client.models.transaction_status import TransactionStatus from typing import Optional, Set from typing_extensions import Self @@ -29,8 +29,7 @@ class AlterTransactionResponse(BaseModel): """ # noqa: E501 id: StrictStr status: TransactionStatus - properties: Optional[Dict[str, StrictStr]] = None - __properties: ClassVar[List[str]] = ["id", "status", "properties"] + __properties: ClassVar[List[str]] = ["id", "status"] model_config = ConfigDict( populate_by_name=True, @@ -84,8 +83,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "id": obj.get("id"), - "status": obj.get("status"), - "properties": obj.get("properties") + "status": obj.get("status") }) return _obj diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_request.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_request.py new file mode 100644 index 000000000..4a7c32a9c --- /dev/null +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_request.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DeregisterTableRequest(BaseModel): + """ + DeregisterTableRequest + """ # noqa: E501 + name: StrictStr + namespace: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["name", "namespace"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeregisterTableRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeregisterTableRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "namespace": obj.get("namespace") + }) + return _obj + + diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_response.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_response.py new file mode 100644 index 000000000..0acddf459 --- /dev/null +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/deregister_table_response.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DeregisterTableResponse(BaseModel): + """ + DeregisterTableResponse + """ # noqa: E501 + name: Optional[StrictStr] = None + namespace: Optional[List[StrictStr]] = None + location: Optional[StrictStr] = None + properties: Optional[Dict[str, StrictStr]] = None + __properties: ClassVar[List[str]] = ["name", "namespace", "location", "properties"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeregisterTableResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeregisterTableResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "namespace": obj.get("namespace"), + "location": obj.get("location"), + "properties": obj.get("properties") + }) + return _obj + + diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_request.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_request.py new file mode 100644 index 000000000..eae5f60de --- /dev/null +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_request.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DropTableRequest(BaseModel): + """ + DropTableRequest + """ # noqa: E501 + name: StrictStr + namespace: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["name", "namespace"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DropTableRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DropTableRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "namespace": obj.get("namespace") + }) + return _obj + + diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_response.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_response.py new file mode 100644 index 000000000..d7b5ce052 --- /dev/null +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/drop_table_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DropTableResponse(BaseModel): + """ + DropTableResponse + """ # noqa: E501 + name: Optional[StrictStr] = None + namespace: Optional[List[StrictStr]] = None + location: Optional[StrictStr] = None + properties: Optional[Dict[str, StrictStr]] = None + transaction_id: Optional[StrictStr] = Field(default=None, alias="transactionId") + __properties: ClassVar[List[str]] = ["name", "namespace", "location", "properties", "transactionId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DropTableResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DropTableResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "namespace": obj.get("namespace"), + "location": obj.get("location"), + "properties": obj.get("properties"), + "transactionId": obj.get("transactionId") + }) + return _obj + + diff --git a/python/lance_namespace_urllib3_client/test/test_alter_transaction_response.py b/python/lance_namespace_urllib3_client/test/test_alter_transaction_response.py index fcae6a03f..cb01b3fcd 100644 --- a/python/lance_namespace_urllib3_client/test/test_alter_transaction_response.py +++ b/python/lance_namespace_urllib3_client/test/test_alter_transaction_response.py @@ -36,10 +36,7 @@ def make_instance(self, include_optional) -> AlterTransactionResponse: if include_optional: return AlterTransactionResponse( id = '', - status = 'QUEUED', - properties = { - 'key' : '' - } + status = 'QUEUED' ) else: return AlterTransactionResponse( diff --git a/python/lance_namespace_urllib3_client/test/test_deregister_table_request.py b/python/lance_namespace_urllib3_client/test/test_deregister_table_request.py new file mode 100644 index 000000000..bf211901f --- /dev/null +++ b/python/lance_namespace_urllib3_client/test/test_deregister_table_request.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lance_namespace_urllib3_client.models.deregister_table_request import DeregisterTableRequest + +class TestDeregisterTableRequest(unittest.TestCase): + """DeregisterTableRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeregisterTableRequest: + """Test DeregisterTableRequest + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeregisterTableRequest` + """ + model = DeregisterTableRequest() + if include_optional: + return DeregisterTableRequest( + name = '', + namespace = [ + '' + ] + ) + else: + return DeregisterTableRequest( + name = '', + ) + """ + + def testDeregisterTableRequest(self): + """Test DeregisterTableRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/python/lance_namespace_urllib3_client/test/test_deregister_table_response.py b/python/lance_namespace_urllib3_client/test/test_deregister_table_response.py new file mode 100644 index 000000000..750a3a99f --- /dev/null +++ b/python/lance_namespace_urllib3_client/test/test_deregister_table_response.py @@ -0,0 +1,58 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lance_namespace_urllib3_client.models.deregister_table_response import DeregisterTableResponse + +class TestDeregisterTableResponse(unittest.TestCase): + """DeregisterTableResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeregisterTableResponse: + """Test DeregisterTableResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeregisterTableResponse` + """ + model = DeregisterTableResponse() + if include_optional: + return DeregisterTableResponse( + name = '', + namespace = [ + '' + ], + location = '', + properties = { + 'key' : '' + } + ) + else: + return DeregisterTableResponse( + ) + """ + + def testDeregisterTableResponse(self): + """Test DeregisterTableResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/python/lance_namespace_urllib3_client/test/test_drop_table_request.py b/python/lance_namespace_urllib3_client/test/test_drop_table_request.py new file mode 100644 index 000000000..93534f6f7 --- /dev/null +++ b/python/lance_namespace_urllib3_client/test/test_drop_table_request.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lance_namespace_urllib3_client.models.drop_table_request import DropTableRequest + +class TestDropTableRequest(unittest.TestCase): + """DropTableRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DropTableRequest: + """Test DropTableRequest + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DropTableRequest` + """ + model = DropTableRequest() + if include_optional: + return DropTableRequest( + name = '', + namespace = [ + '' + ] + ) + else: + return DropTableRequest( + name = '', + ) + """ + + def testDropTableRequest(self): + """Test DropTableRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/python/lance_namespace_urllib3_client/test/test_drop_table_response.py b/python/lance_namespace_urllib3_client/test/test_drop_table_response.py new file mode 100644 index 000000000..d46cd4a64 --- /dev/null +++ b/python/lance_namespace_urllib3_client/test/test_drop_table_response.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +""" + Lance REST Namespace Specification + + **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lance_namespace_urllib3_client.models.drop_table_response import DropTableResponse + +class TestDropTableResponse(unittest.TestCase): + """DropTableResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DropTableResponse: + """Test DropTableResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DropTableResponse` + """ + model = DropTableResponse() + if include_optional: + return DropTableResponse( + name = '', + namespace = [ + '' + ], + location = '', + properties = { + 'key' : '' + }, + transaction_id = '' + ) + else: + return DropTableResponse( + ) + """ + + def testDropTableResponse(self): + """Test DropTableResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/python/lance_namespace_urllib3_client/test/test_table_api.py b/python/lance_namespace_urllib3_client/test/test_table_api.py index 8c316b763..6ab2cb5f0 100644 --- a/python/lance_namespace_urllib3_client/test/test_table_api.py +++ b/python/lance_namespace_urllib3_client/test/test_table_api.py @@ -26,6 +26,20 @@ def setUp(self) -> None: def tearDown(self) -> None: pass + def test_deregister_table(self) -> None: + """Test case for deregister_table + + Deregister a table from its namespace + """ + pass + + def test_drop_table(self) -> None: + """Test case for drop_table + + Drop a table from its namespace + """ + pass + def test_get_table(self) -> None: """Test case for get_table diff --git a/rust/lance-namespace-reqwest-client/README.md b/rust/lance-namespace-reqwest-client/README.md index 7c2fde516..87672fed0 100644 --- a/rust/lance-namespace-reqwest-client/README.md +++ b/rust/lance-namespace-reqwest-client/README.md @@ -34,6 +34,8 @@ Class | Method | HTTP request | Description *NamespaceApi* | [**get_namespace**](docs/NamespaceApi.md#get_namespace) | **POST** /GetNamespace | Get information about a namespace *NamespaceApi* | [**list_namespaces**](docs/NamespaceApi.md#list_namespaces) | **POST** /ListNamespaces | List namespaces *NamespaceApi* | [**namespace_exists**](docs/NamespaceApi.md#namespace_exists) | **POST** /NamespaceExists | Check if a namespace exists +*TableApi* | [**deregister_table**](docs/TableApi.md#deregister_table) | **POST** /DeregisterTable | Deregister a table from its namespace +*TableApi* | [**drop_table**](docs/TableApi.md#drop_table) | **POST** /DropTable | Drop a table from its namespace *TableApi* | [**get_table**](docs/TableApi.md#get_table) | **POST** /GetTable | Get a table from the namespace *TableApi* | [**register_table**](docs/TableApi.md#register_table) | **POST** /RegisterTable | Register a table to a namespace *TableApi* | [**table_exists**](docs/TableApi.md#table_exists) | **POST** /TableExists | Check if a table exists @@ -51,8 +53,12 @@ Class | Method | HTTP request | Description - [AlterTransactionUnsetProperty](docs/AlterTransactionUnsetProperty.md) - [CreateNamespaceRequest](docs/CreateNamespaceRequest.md) - [CreateNamespaceResponse](docs/CreateNamespaceResponse.md) + - [DeregisterTableRequest](docs/DeregisterTableRequest.md) + - [DeregisterTableResponse](docs/DeregisterTableResponse.md) - [DropNamespaceRequest](docs/DropNamespaceRequest.md) - [DropNamespaceResponse](docs/DropNamespaceResponse.md) + - [DropTableRequest](docs/DropTableRequest.md) + - [DropTableResponse](docs/DropTableResponse.md) - [ErrorResponse](docs/ErrorResponse.md) - [GetNamespaceRequest](docs/GetNamespaceRequest.md) - [GetNamespaceResponse](docs/GetNamespaceResponse.md) diff --git a/rust/lance-namespace-reqwest-client/docs/AlterTransactionResponse.md b/rust/lance-namespace-reqwest-client/docs/AlterTransactionResponse.md index 77d51b56b..e0b8c6bb4 100644 --- a/rust/lance-namespace-reqwest-client/docs/AlterTransactionResponse.md +++ b/rust/lance-namespace-reqwest-client/docs/AlterTransactionResponse.md @@ -6,7 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | **status** | [**models::TransactionStatus**](TransactionStatus.md) | | -**properties** | Option<**std::collections::HashMap**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rust/lance-namespace-reqwest-client/docs/DeregisterTableRequest.md b/rust/lance-namespace-reqwest-client/docs/DeregisterTableRequest.md new file mode 100644 index 000000000..d436e6286 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/docs/DeregisterTableRequest.md @@ -0,0 +1,12 @@ +# DeregisterTableRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**namespace** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rust/lance-namespace-reqwest-client/docs/DeregisterTableResponse.md b/rust/lance-namespace-reqwest-client/docs/DeregisterTableResponse.md new file mode 100644 index 000000000..980be2252 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/docs/DeregisterTableResponse.md @@ -0,0 +1,14 @@ +# DeregisterTableResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | | [optional] +**namespace** | Option<**Vec**> | | [optional] +**location** | Option<**String**> | | [optional] +**properties** | Option<**std::collections::HashMap**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rust/lance-namespace-reqwest-client/docs/DropTableRequest.md b/rust/lance-namespace-reqwest-client/docs/DropTableRequest.md new file mode 100644 index 000000000..a5520fa2b --- /dev/null +++ b/rust/lance-namespace-reqwest-client/docs/DropTableRequest.md @@ -0,0 +1,12 @@ +# DropTableRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**namespace** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rust/lance-namespace-reqwest-client/docs/DropTableResponse.md b/rust/lance-namespace-reqwest-client/docs/DropTableResponse.md new file mode 100644 index 000000000..e97d0c1a6 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/docs/DropTableResponse.md @@ -0,0 +1,15 @@ +# DropTableResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | | [optional] +**namespace** | Option<**Vec**> | | [optional] +**location** | Option<**String**> | | [optional] +**properties** | Option<**std::collections::HashMap**> | | [optional] +**transaction_id** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rust/lance-namespace-reqwest-client/docs/TableApi.md b/rust/lance-namespace-reqwest-client/docs/TableApi.md index 1e09176e0..02df58206 100644 --- a/rust/lance-namespace-reqwest-client/docs/TableApi.md +++ b/rust/lance-namespace-reqwest-client/docs/TableApi.md @@ -4,12 +4,74 @@ All URIs are relative to *http://localhost:2333* Method | HTTP request | Description ------------- | ------------- | ------------- +[**deregister_table**](TableApi.md#deregister_table) | **POST** /DeregisterTable | Deregister a table from its namespace +[**drop_table**](TableApi.md#drop_table) | **POST** /DropTable | Drop a table from its namespace [**get_table**](TableApi.md#get_table) | **POST** /GetTable | Get a table from the namespace [**register_table**](TableApi.md#register_table) | **POST** /RegisterTable | Register a table to a namespace [**table_exists**](TableApi.md#table_exists) | **POST** /TableExists | Check if a table exists +## deregister_table + +> models::DeregisterTableResponse deregister_table(deregister_table_request) +Deregister a table from its namespace + +Deregister a table from its namespace. The table content remains available in the storage. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**deregister_table_request** | [**DeregisterTableRequest**](DeregisterTableRequest.md) | | [required] | + +### Return type + +[**models::DeregisterTableResponse**](DeregisterTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## drop_table + +> models::DropTableResponse drop_table(drop_table_request) +Drop a table from its namespace + +Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**drop_table_request** | [**DropTableRequest**](DropTableRequest.md) | | [required] | + +### Return type + +[**models::DropTableResponse**](DropTableResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_table > models::GetTableResponse get_table(get_table_request) diff --git a/rust/lance-namespace-reqwest-client/src/apis/table_api.rs b/rust/lance-namespace-reqwest-client/src/apis/table_api.rs index c8342842f..40c43ce4e 100644 --- a/rust/lance-namespace-reqwest-client/src/apis/table_api.rs +++ b/rust/lance-namespace-reqwest-client/src/apis/table_api.rs @@ -15,6 +15,32 @@ use crate::{apis::ResponseContent, models}; use super::{Error, configuration, ContentType}; +/// struct for typed errors of method [`deregister_table`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeregisterTableError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status403(models::ErrorResponse), + Status404(models::ErrorResponse), + Status503(models::ErrorResponse), + Status5XX(models::ErrorResponse), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`drop_table`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DropTableError { + Status400(models::ErrorResponse), + Status401(models::ErrorResponse), + Status403(models::ErrorResponse), + Status404(models::ErrorResponse), + Status503(models::ErrorResponse), + Status5XX(models::ErrorResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_table`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -56,6 +82,82 @@ pub enum TableExistsError { } +/// Deregister a table from its namespace. The table content remains available in the storage. +pub async fn deregister_table(configuration: &configuration::Configuration, deregister_table_request: models::DeregisterTableRequest) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_deregister_table_request = deregister_table_request; + + let uri_str = format!("{}/DeregisterTable", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_deregister_table_request); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeregisterTableResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeregisterTableResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Drop a table from its namespace and delete its data. If the table and its data can be immediately deleted, return information of the deleted table. Otherwise, return a transaction ID that client can use to track deletion progress. +pub async fn drop_table(configuration: &configuration::Configuration, drop_table_request: models::DropTableRequest) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_drop_table_request = drop_table_request; + + let uri_str = format!("{}/DropTable", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_drop_table_request); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DropTableResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DropTableResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// Get a table's detailed information under a specified namespace. pub async fn get_table(configuration: &configuration::Configuration, get_table_request: models::GetTableRequest) -> Result> { // add a prefix to parameters to efficiently prevent name collisions diff --git a/rust/lance-namespace-reqwest-client/src/models/alter_transaction_response.rs b/rust/lance-namespace-reqwest-client/src/models/alter_transaction_response.rs index 3905162a7..0183e6b70 100644 --- a/rust/lance-namespace-reqwest-client/src/models/alter_transaction_response.rs +++ b/rust/lance-namespace-reqwest-client/src/models/alter_transaction_response.rs @@ -17,8 +17,6 @@ pub struct AlterTransactionResponse { pub id: String, #[serde(rename = "status")] pub status: models::TransactionStatus, - #[serde(rename = "properties", skip_serializing_if = "Option::is_none")] - pub properties: Option>, } impl AlterTransactionResponse { @@ -26,7 +24,6 @@ impl AlterTransactionResponse { AlterTransactionResponse { id, status, - properties: None, } } } diff --git a/rust/lance-namespace-reqwest-client/src/models/deregister_table_request.rs b/rust/lance-namespace-reqwest-client/src/models/deregister_table_request.rs new file mode 100644 index 000000000..f9f6d0cc0 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/src/models/deregister_table_request.rs @@ -0,0 +1,30 @@ +/* + * Lance REST Namespace Specification + * + * **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeregisterTableRequest { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option>, +} + +impl DeregisterTableRequest { + pub fn new(name: String) -> DeregisterTableRequest { + DeregisterTableRequest { + name, + namespace: None, + } + } +} + diff --git a/rust/lance-namespace-reqwest-client/src/models/deregister_table_response.rs b/rust/lance-namespace-reqwest-client/src/models/deregister_table_response.rs new file mode 100644 index 000000000..af032034e --- /dev/null +++ b/rust/lance-namespace-reqwest-client/src/models/deregister_table_response.rs @@ -0,0 +1,36 @@ +/* + * Lance REST Namespace Specification + * + * **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeregisterTableResponse { + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option>, + #[serde(rename = "location", skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "properties", skip_serializing_if = "Option::is_none")] + pub properties: Option>, +} + +impl DeregisterTableResponse { + pub fn new() -> DeregisterTableResponse { + DeregisterTableResponse { + name: None, + namespace: None, + location: None, + properties: None, + } + } +} + diff --git a/rust/lance-namespace-reqwest-client/src/models/drop_table_request.rs b/rust/lance-namespace-reqwest-client/src/models/drop_table_request.rs new file mode 100644 index 000000000..8d0166b73 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/src/models/drop_table_request.rs @@ -0,0 +1,30 @@ +/* + * Lance REST Namespace Specification + * + * **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DropTableRequest { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option>, +} + +impl DropTableRequest { + pub fn new(name: String) -> DropTableRequest { + DropTableRequest { + name, + namespace: None, + } + } +} + diff --git a/rust/lance-namespace-reqwest-client/src/models/drop_table_response.rs b/rust/lance-namespace-reqwest-client/src/models/drop_table_response.rs new file mode 100644 index 000000000..d1f0b5522 --- /dev/null +++ b/rust/lance-namespace-reqwest-client/src/models/drop_table_response.rs @@ -0,0 +1,39 @@ +/* + * Lance REST Namespace Specification + * + * **Lance Namespace Specification** is an open specification on top of the storage-based Lance data format to standardize access to a collection of Lance tables (a.k.a. Lance datasets). It describes how a metadata service like Apache Hive MetaStore (HMS), Apache Gravitino, Unity Catalog, etc. should store and use Lance tables, as well as how ML/AI tools and analytics compute engines (will together be called _\"tools\"_ in this document) should integrate with Lance tables. A Lance namespace is a centralized repository for discovering, organizing, and managing Lance tables. It can either contain a collection of tables, or a collection of Lance namespaces recursively. It is designed to encapsulates concepts including namespace, metastore, database, schema, etc. that frequently appear in other similar data systems to allow easy integration with any system of any type of object hierarchy. In an enterprise environment, typically there is a requirement to store tables in a metadata service for more advanced governance features around access control, auditing, lineage tracking, etc. **Lance REST Namespace** is an OpenAPI protocol that enables reading, writing and managing Lance tables by connecting those metadata services or building a custom metadata server in a standardized way. + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DropTableResponse { + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option>, + #[serde(rename = "location", skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "properties", skip_serializing_if = "Option::is_none")] + pub properties: Option>, + #[serde(rename = "transactionId", skip_serializing_if = "Option::is_none")] + pub transaction_id: Option, +} + +impl DropTableResponse { + pub fn new() -> DropTableResponse { + DropTableResponse { + name: None, + namespace: None, + location: None, + properties: None, + transaction_id: None, + } + } +} + diff --git a/rust/lance-namespace-reqwest-client/src/models/mod.rs b/rust/lance-namespace-reqwest-client/src/models/mod.rs index 700a4c1c0..0ef307eac 100644 --- a/rust/lance-namespace-reqwest-client/src/models/mod.rs +++ b/rust/lance-namespace-reqwest-client/src/models/mod.rs @@ -14,10 +14,18 @@ pub mod create_namespace_request; pub use self::create_namespace_request::CreateNamespaceRequest; pub mod create_namespace_response; pub use self::create_namespace_response::CreateNamespaceResponse; +pub mod deregister_table_request; +pub use self::deregister_table_request::DeregisterTableRequest; +pub mod deregister_table_response; +pub use self::deregister_table_response::DeregisterTableResponse; pub mod drop_namespace_request; pub use self::drop_namespace_request::DropNamespaceRequest; pub mod drop_namespace_response; pub use self::drop_namespace_response::DropNamespaceResponse; +pub mod drop_table_request; +pub use self::drop_table_request::DropTableRequest; +pub mod drop_table_response; +pub use self::drop_table_response::DropTableResponse; pub mod error_response; pub use self::error_response::ErrorResponse; pub mod get_namespace_request; diff --git a/spec/rest.yaml b/spec/rest.yaml index 2cde85818..bbb4756bb 100644 --- a/spec/rest.yaml +++ b/spec/rest.yaml @@ -366,6 +366,66 @@ paths: 5XX: $ref: '#/components/responses/ServerErrorResponse' + /DropTable: + post: + tags: [ Table ] + summary: Drop a table from its namespace + operationId: DropTable + description: > + Drop a table from its namespace and delete its data. + If the table and its data can be immediately deleted, return information of the deleted table. + Otherwise, return a transaction ID that client can use to track deletion progress. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DropTableRequest' + responses: + 200: + $ref: '#/components/responses/DropTableResponse' + 400: + $ref: '#/components/responses/BadRequestErrorResponse' + 401: + $ref: '#/components/responses/UnauthorizedErrorResponse' + 403: + $ref: '#/components/responses/ForbiddenErrorResponse' + 404: + $ref: '#/components/responses/NotFoundErrorResponse' + 503: + $ref: '#/components/responses/ServiceUnavailableErrorResponse' + 5XX: + $ref: '#/components/responses/ServerErrorResponse' + + /DeregisterTable: + post: + tags: [ Table ] + summary: Deregister a table from its namespace + operationId: DeregisterTable + description: > + Deregister a table from its namespace. The table content remains available in the storage. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeregisterTableRequest' + responses: + 200: + $ref: '#/components/responses/DeregisterTableResponse' + 400: + $ref: '#/components/responses/BadRequestErrorResponse' + 401: + $ref: '#/components/responses/UnauthorizedErrorResponse' + 403: + $ref: '#/components/responses/ForbiddenErrorResponse' + 404: + $ref: '#/components/responses/NotFoundErrorResponse' + 503: + $ref: '#/components/responses/ServiceUnavailableErrorResponse' + 5XX: + $ref: '#/components/responses/ServerErrorResponse' + components: schemas: ErrorResponse: @@ -795,6 +855,60 @@ components: type: string status: $ref: '#/components/schemas/TransactionStatus' + + DropTableRequest: + type: object + required: + - name + properties: + name: + type: string + namespace: + type: array + items: + type: string + + DropTableResponse: + type: object + properties: + name: + type: string + namespace: + type: array + items: + type: string + location: + type: string + properties: + type: object + additionalProperties: + type: string + transactionId: + type: string + + DeregisterTableRequest: + type: object + required: + - name + properties: + name: + type: string + namespace: + type: array + items: + type: string + + DeregisterTableResponse: + type: object + properties: + name: + type: string + namespace: + type: array + items: + type: string + location: + type: string properties: type: object additionalProperties: @@ -882,6 +996,22 @@ components: schema: $ref: '#/components/schemas/AlterTransactionResponse' + DropTableResponse: + description: + Response of DropTable + content: + application/json: + schema: + $ref: '#/components/schemas/DropTableResponse' + + DeregisterTableResponse: + description: + Response of DeregisterTable + content: + application/json: + schema: + $ref: '#/components/schemas/DeregisterTableResponse' + # Error Responses BadRequestErrorResponse: diff --git a/spec/spec.md b/spec/spec.md index 008af04b8..ea03ecde0 100644 --- a/spec/spec.md +++ b/spec/spec.md @@ -95,6 +95,8 @@ The Lance Namespace Specification defines a list of operations that can be perfo | RegisterTable | Register an existing table at a given storage location to a namespace | | AlterTable | Alter information of a Lance table | | DropTable | Drop a table from its namespace | +| DropTable | Drop a table from its namespace, also delete its data | +| DeregisterTable | Deregister a table from its namespace, table content is kept unchanged in storage | | GetTransaction | Describe information of a transaction | | AlterTransaction | Alter information of a transaction |