Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/lance-catalog-apache-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
*NamespaceApi* | [**namespaceExists**](docs/NamespaceApi.md#namespaceExists) | **HEAD** /v1/namespaces/{ns} | Check if a namespace exists
*TableApi* | [**getTable**](docs/TableApi.md#getTable) | **GET** /v1/namespaces/{ns}/tables/{table} | Get a table from the catalog
*TableApi* | [**registerTable**](docs/TableApi.md#registerTable) | **POST** /v1/namespaces/{ns}/register | Register a new table in the given namespace. A table represents a lance dataset. In Lance catalog, a table must be hosted in a namespace.
*TableApi* | [**tableExists**](docs/TableApi.md#tableExists) | **HEAD** /v1/namespaces/{ns}/tables/{table} | Check if a table exists


## Documentation for Models
Expand Down
26 changes: 26 additions & 0 deletions java/lance-catalog-apache-client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,32 @@ paths:
- Table
x-accepts:
- application/json
head:
description: Check if a table exists within a given namespace.
operationId: TableExists
parameters:
- $ref: '#/components/parameters/namespace'
- $ref: '#/components/parameters/table'
responses:
"200":
description: "Success, no content"
"400":
$ref: '#/components/responses/BadRequestErrorResponse'
"401":
$ref: '#/components/responses/UnauthorizedResponse'
"403":
$ref: '#/components/responses/ForbiddenResponse'
"404":
$ref: '#/components/responses/NotFoundResponse'
"503":
$ref: '#/components/responses/ServiceUnavailableResponse'
"5XX":
$ref: '#/components/responses/ServerErrorResponse'
summary: Check if a table exists
tags:
- Table
x-accepts:
- application/json
parameters:
- $ref: '#/components/parameters/namespace'
- $ref: '#/components/parameters/table'
Expand Down
74 changes: 74 additions & 0 deletions java/lance-catalog-apache-client/docs/TableApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All URIs are relative to *http://localhost:2333*
|------------- | ------------- | -------------|
| [**getTable**](TableApi.md#getTable) | **GET** /v1/namespaces/{ns}/tables/{table} | Get a table from the catalog |
| [**registerTable**](TableApi.md#registerTable) | **POST** /v1/namespaces/{ns}/register | Register a new table in the given namespace. A table represents a lance dataset. In Lance catalog, a table must be hosted in a namespace. |
| [**tableExists**](TableApi.md#tableExists) | **HEAD** /v1/namespaces/{ns}/tables/{table} | Check if a table exists |



Expand Down Expand Up @@ -155,3 +156,76 @@ No authorization required
| **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. | - |


## tableExists

> tableExists(ns, table)

Check if a table exists

Check if a table exists within a given namespace.

### Example

```java
// Import classes:
import com.lancedb.lance.catalog.client.apache.ApiClient;
import com.lancedb.lance.catalog.client.apache.ApiException;
import com.lancedb.lance.catalog.client.apache.Configuration;
import com.lancedb.lance.catalog.client.apache.models.*;
import com.lancedb.lance.catalog.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);
String ns = "ns_example"; // String | The name of the namespace.
String table = "table_example"; // String | A table name.
try {
apiInstance.tableExists(ns, table);
} catch (ApiException e) {
System.err.println("Exception when calling TableApi#tableExists");
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 |
|------------- | ------------- | ------------- | -------------|
| **ns** | **String**| The name of the namespace. | |
| **table** | **String**| A table name. | |

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success, no content | - |
| **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. | - |

Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,84 @@ public GetTableResponse registerTable(
localVarReturnType);
}

/**
* Check if a table exists Check if a table exists within a given namespace.
*
* @param ns The name of the namespace. (required)
* @param table A table name. (required)
* @throws ApiException if fails to make API call
*/
public void tableExists(String ns, String table) throws ApiException {
this.tableExists(ns, table, Collections.emptyMap());
}

/**
* Check if a table exists Check if a table exists within a given namespace.
*
* @param ns The name of the namespace. (required)
* @param table A table name. (required)
* @param additionalHeaders additionalHeaders for this call
* @throws ApiException if fails to make API call
*/
public void tableExists(String ns, String table, Map<String, String> additionalHeaders)
throws ApiException {
Object localVarPostBody = null;

// verify the required parameter 'ns' is set
if (ns == null) {
throw new ApiException(400, "Missing the required parameter 'ns' when calling tableExists");
}

// verify the required parameter 'table' is set
if (table == null) {
throw new ApiException(
400, "Missing the required parameter 'table' when calling tableExists");
}

// create path and map variables
String localVarPath =
"/v1/namespaces/{ns}/tables/{table}"
.replaceAll(
"\\{" + "ns" + "\\}", apiClient.escapeString(apiClient.parameterToString(ns)))
.replaceAll(
"\\{" + "table" + "\\}",
apiClient.escapeString(apiClient.parameterToString(table)));

StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

localVarHeaderParams.putAll(additionalHeaders);

final String[] localVarAccepts = {"application/json"};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

final String[] localVarContentTypes = {};

final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] {};

apiClient.invokeAPI(
localVarPath,
"HEAD",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null);
}

@Override
public <T> T invokeAPI(
String url,
Expand All @@ -227,7 +305,8 @@ public <T> T invokeAPI(
final String[] localVarAccepts = {"application/json"};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

final String[] localVarContentTypes = {"application/json"};
final String[] localVarContentTypes = {};

final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,4 +374,147 @@ default ResponseEntity<GetTableResponse> registerTable(
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

/**
* HEAD /v1/namespaces/{ns}/tables/{table} : Check if a table exists Check if a table exists
* within a given namespace.
*
* @param ns The name of the namespace. (required)
* @param table A table name. (required)
* @return Success, no content (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&#39;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 = "tableExists",
summary = "Check if a table exists",
description = "Check if a table exists within a given namespace.",
tags = {"Table"},
responses = {
@ApiResponse(responseCode = "200", description = "Success, no content"),
@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 = ErrorModel.class))
}),
@ApiResponse(
responseCode = "401",
description =
"Unauthorized. The request lacks valid authentication credentials for the operation.",
content = {
@Content(
mediaType = "application/json",
schema = @Schema(implementation = ErrorModel.class))
}),
@ApiResponse(
responseCode = "403",
description = "Forbidden. Authenticated user does not have the necessary permissions.",
content = {
@Content(
mediaType = "application/json",
schema = @Schema(implementation = ErrorModel.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 = ErrorModel.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 = ErrorModel.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 = ErrorModel.class))
})
})
@RequestMapping(
method = RequestMethod.HEAD,
value = "/v1/namespaces/{ns}/tables/{table}",
produces = {"application/json"})
default ResponseEntity<Void> tableExists(
@Parameter(
name = "ns",
description = "The name of the namespace.",
required = true,
in = ParameterIn.PATH)
@PathVariable("ns")
String ns,
@Parameter(
name = "table",
description = "A table name.",
required = true,
in = ParameterIn.PATH)
@PathVariable("table")
String table) {
getRequest()
.ifPresent(
request -> {
for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) {
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);
}
}
1 change: 1 addition & 0 deletions python/lance_catalog_urllib3_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
*NamespaceApi* | [**namespace_exists**](docs/NamespaceApi.md#namespace_exists) | **HEAD** /v1/namespaces/{ns} | Check if a namespace exists
*TableApi* | [**get_table**](docs/TableApi.md#get_table) | **GET** /v1/namespaces/{ns}/tables/{table} | Get a table from the catalog
*TableApi* | [**register_table**](docs/TableApi.md#register_table) | **POST** /v1/namespaces/{ns}/register | Register a new table in the given namespace. A table represents a lance dataset. In Lance catalog, a table must be hosted in a namespace.
*TableApi* | [**table_exists**](docs/TableApi.md#table_exists) | **HEAD** /v1/namespaces/{ns}/tables/{table} | Check if a table exists


## Documentation For Models
Expand Down
Loading