Skip to content

Commit 76be132

Browse files
authored
feat: add CreateTable REST storage options and properties and remove CreateEmptyTable (#330)
## Summary - add `CreateTableRequest.storage_options` and map both `properties` and `storage_options` through the REST `CreateTable` API as JSON-encoded query parameters - remove the deprecated `CreateEmptyTable` REST API, models, and hand-written core interface methods in generated and source docs/code - document the `CreateTable` REST translation more clearly, add `409 Conflict`, and fix the Arrow stream content type in the impl spec
1 parent 8382878 commit 76be132

96 files changed

Lines changed: 915 additions & 5581 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/src/client/operations/errors.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ All operations may return the following errors:
7171
| TableExists | 1 (NamespaceNotFound), 4 (TableNotFound) |
7272
| DropTable | 1 (NamespaceNotFound), 4 (TableNotFound) |
7373
| DeregisterTable | 1 (NamespaceNotFound), 4 (TableNotFound) |
74-
| CreateEmptyTable | 1 (NamespaceNotFound), 5 (TableAlreadyExists), 14 (ConcurrentModification) |
7574
| RestoreTable | 1 (NamespaceNotFound), 4 (TableNotFound), 11 (TableVersionNotFound), 14 (ConcurrentModification) |
7675
| RenameTable | 1 (NamespaceNotFound), 4 (TableNotFound), 5 (TableAlreadyExists), 14 (ConcurrentModification) |
7776
| GetTableStats | 1 (NamespaceNotFound), 4 (TableNotFound) |

docs/src/client/operations/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ See [REST Routes](../../rest/catalog-spec.md#rest-routes) for more details.
6161
| CountTableRows | 1 | || | || |
6262
| CreateTable | 1 | || | || |
6363
| DeclareTable | 1 | || || | |
64-
| CreateEmptyTable | 1 (deprecated) | || || | |
6564
| CreateTableIndex | 1 | |||| | |
6665
| CreateTableScalarIndex | 1 | |||| | |
6766
| ListTableIndices | 1 | |||| | |

docs/src/client/operations/models/CreateEmptyTableRequest.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/src/client/operations/models/CreateEmptyTableResponse.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/src/client/operations/models/CreateTableRequest.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# CreateTableRequest
44

5-
Request for creating a table, excluding the Arrow IPC stream.
5+
Request for creating a table, excluding the Arrow IPC stream. The table location and any credential vending behavior are determined by the implementation and returned in the response, rather than specified in this request.
66

77
## Properties
88

@@ -12,7 +12,8 @@ Request for creating a table, excluding the Arrow IPC stream.
1212
|**context** | **Map<String, String>** | Arbitrary context for a request as key-value pairs. How to use the context is custom to the specific implementation. REST NAMESPACE ONLY Context entries are passed via HTTP headers using the naming convention `x-lance-ctx-<key>: <value>`. For example, a context entry `{\"trace_id\": \"abc123\"}` would be sent as the header `x-lance-ctx-trace_id: abc123`. | [optional] |
1313
|**id** | **List<String>** | | [optional] |
1414
|**mode** | **String** | There are three modes when trying to create a table, to differentiate the behavior when a table of the same name already exists. Case insensitive, supports both PascalCase and snake_case. Valid values are: * Create: the operation fails with 409. * ExistOk: the operation succeeds and the existing table is kept. * Overwrite: the existing table is dropped and a new table with this name is created. | [optional] |
15-
|**properties** | **Map<String, String>** | Properties stored on the table, if supported by the implementation. | [optional] |
15+
|**properties** | **Map<String, String>** | Business logic properties stored and managed by the namespace implementation outside Lance context, if supported by the implementation. | [optional] |
16+
|**storageOptions** | **Map<String, String>** | Storage options that configure overrides for writing table data and metadata during table creation. These are passed to Lance for the write path. | [optional] |
1617

1718

1819

docs/src/client/operations/models/CreateTableResponse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
|**location** | **String** | | [optional] |
1212
|**version** | **Long** | | [optional] |
1313
|**storageOptions** | **Map<String, String>** | Configuration options to be used to access storage. The available options depend on the type of storage in use. These will be passed directly to Lance to initialize storage access. | [optional] |
14-
|**properties** | **Map<String, String>** | If the implementation does not support table properties, it should return null for this field. Otherwise it should return the properties. | [optional] |
14+
|**properties** | **Map<String, String>** | Business logic properties stored and managed by the namespace implementation outside Lance context. If the implementation does not support table properties, it should return null for this field. | [optional] |
1515

1616

1717

docs/src/client/operations/models/DeclareTableRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Request for declaring a table.
1313
|**id** | **List<String>** | | [optional] |
1414
|**location** | **String** | Optional storage location for the table. If not provided, the namespace implementation should determine the table location. | [optional] |
1515
|**vendCredentials** | **Boolean** | Whether to include vended credentials in the response `storage_options`. When true, the implementation should provide vended credentials for accessing storage. When not set, the implementation can decide whether to return vended credentials. | [optional] |
16-
|**properties** | **Map<String, String>** | Properties stored on the table, if supported by the server. | [optional] |
16+
|**properties** | **Map<String, String>** | Business logic properties stored and managed by the namespace implementation outside Lance context, if supported by the implementation. | [optional] |
1717

1818

1919

docs/src/rest.yaml

Lines changed: 43 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,25 @@ paths:
13211321
required: false
13221322
schema:
13231323
type: string
1324+
- name: "properties"
1325+
in: query
1326+
required: false
1327+
schema:
1328+
type: string
1329+
description: |
1330+
Business logic properties managed by the namespace implementation outside Lance context.
1331+
The map is translated to a single JSON-encoded query parameter such as
1332+
`properties={"user":"alice","team":"eng"}`.
1333+
- name: "storage_options"
1334+
in: query
1335+
required: false
1336+
schema:
1337+
type: string
1338+
description: |
1339+
Storage options that configure overrides for writing table data and metadata during
1340+
table creation. These are passed to Lance for the write path.
1341+
The map is translated to a single JSON-encoded query parameter such as
1342+
`storage_options={"aws_region":"us-east-1","timeout":"30s"}`.
13241343
post:
13251344
tags:
13261345
- Table
@@ -1338,6 +1357,12 @@ paths:
13381357
It passes in the `CreateTableRequest` information in the following way:
13391358
- `id`: pass through path parameter of the same name
13401359
- `mode`: pass through query parameter of the same name
1360+
- `properties`: serialize as a single JSON-encoded query parameter such as
1361+
`properties={"user":"alice","team":"eng"}`; these are business logic properties
1362+
managed by the namespace implementation outside Lance context
1363+
- `storage_options`: serialize as a single JSON-encoded query parameter such as
1364+
`storage_options={"aws_region":"us-east-1","timeout":"30s"}`; these configure
1365+
write-time overrides for data and metadata written during table creation
13411366
requestBody:
13421367
description: Arrow IPC data
13431368
content:
@@ -1357,6 +1382,8 @@ paths:
13571382
$ref: "#/components/responses/ForbiddenErrorResponse"
13581383
404:
13591384
$ref: "#/components/responses/NotFoundErrorResponse"
1385+
409:
1386+
$ref: "#/components/responses/ConflictErrorResponse"
13601387
503:
13611388
$ref: "#/components/responses/ServiceUnavailableErrorResponse"
13621389
5XX:
@@ -1792,49 +1819,6 @@ paths:
17921819
5XX:
17931820
$ref: "#/components/responses/ServerErrorResponse"
17941821

1795-
/v1/table/{id}/create-empty:
1796-
parameters:
1797-
- $ref: "#/components/parameters/id"
1798-
- $ref: "#/components/parameters/delimiter"
1799-
post:
1800-
tags:
1801-
- Table
1802-
- Metadata
1803-
summary: Create an empty table
1804-
operationId: CreateEmptyTable
1805-
deprecated: true
1806-
description: |
1807-
Create an empty table with the given name without touching storage.
1808-
This is a metadata-only operation that records the table existence and sets up aspects like access control.
1809-
1810-
For DirectoryNamespace implementation, this creates a `.lance-reserved` file in the table directory
1811-
to mark the table's existence without creating actual Lance data files.
1812-
1813-
**Deprecated**: Use `DeclareTable` instead.
1814-
requestBody:
1815-
required: true
1816-
content:
1817-
application/json:
1818-
schema:
1819-
$ref: "#/components/schemas/CreateEmptyTableRequest"
1820-
responses:
1821-
200:
1822-
$ref: "#/components/responses/CreateEmptyTableResponse"
1823-
400:
1824-
$ref: "#/components/responses/BadRequestErrorResponse"
1825-
401:
1826-
$ref: "#/components/responses/UnauthorizedErrorResponse"
1827-
403:
1828-
$ref: "#/components/responses/ForbiddenErrorResponse"
1829-
404:
1830-
$ref: "#/components/responses/NotFoundErrorResponse"
1831-
409:
1832-
$ref: "#/components/responses/ConflictErrorResponse"
1833-
503:
1834-
$ref: "#/components/responses/ServiceUnavailableErrorResponse"
1835-
5XX:
1836-
$ref: "#/components/responses/ServerErrorResponse"
1837-
18381822
/v1/table/{id}/tags/create:
18391823
parameters:
18401824
- $ref: "#/components/parameters/id"
@@ -3163,6 +3147,8 @@ components:
31633147
type: object
31643148
description: |
31653149
Request for creating a table, excluding the Arrow IPC stream.
3150+
The table location and any credential vending behavior are determined by the implementation
3151+
and returned in the response, rather than specified in this request.
31663152
properties:
31673153
identity:
31683154
$ref: "#/components/schemas/Identity"
@@ -3184,87 +3170,30 @@ components:
31843170
properties:
31853171
type: object
31863172
description: |
3187-
Properties stored on the table, if supported by the implementation.
3173+
Business logic properties stored and managed by the namespace implementation outside
3174+
Lance context, if supported by the implementation.
31883175
additionalProperties:
31893176
type: string
3190-
3191-
CreateTableResponse:
3192-
type: object
3193-
properties:
3194-
transaction_id:
3195-
type: string
3196-
description: Optional transaction identifier
3197-
location:
3198-
type: string
3199-
version:
3200-
type: integer
3201-
format: int64
3202-
minimum: 0
32033177
storage_options:
32043178
type: object
32053179
description: |
3206-
Configuration options to be used to access storage. The available
3207-
options depend on the type of storage in use. These will be
3208-
passed directly to Lance to initialize storage access.
3180+
Storage options that configure overrides for writing table data and metadata during
3181+
table creation. These are passed to Lance for the write path.
32093182
additionalProperties:
32103183
type: string
3211-
properties:
3212-
type: object
3213-
description: |
3214-
If the implementation does not support table properties, it should return null for this field. Otherwise it should return the properties.
3215-
additionalProperties:
3216-
type: string
3217-
example: { "owner": "Ralph", "created_at": "1452120468" }
3218-
default: {}
3219-
nullable: true
3220-
3221-
CreateEmptyTableRequest:
3222-
type: object
3223-
deprecated: true
3224-
description: |
3225-
Request for creating an empty table.
32263184

3227-
**Deprecated**: Use `DeclareTableRequest` instead.
3228-
properties:
3229-
identity:
3230-
$ref: "#/components/schemas/Identity"
3231-
context:
3232-
$ref: "#/components/schemas/Context"
3233-
id:
3234-
type: array
3235-
items:
3236-
type: string
3237-
location:
3238-
type: string
3239-
description: |
3240-
Optional storage location for the table.
3241-
If not provided, the namespace implementation should determine the table location.
3242-
vend_credentials:
3243-
description: |
3244-
Whether to include vended credentials in the response `storage_options`.
3245-
When true, the implementation should provide vended credentials for accessing storage.
3246-
When not set, the implementation can decide whether to return vended credentials.
3247-
type: boolean
3248-
properties:
3249-
type: object
3250-
description: |
3251-
Properties stored on the table, if supported by the server.
3252-
additionalProperties:
3253-
type: string
3254-
3255-
CreateEmptyTableResponse:
3185+
CreateTableResponse:
32563186
type: object
3257-
deprecated: true
3258-
description: |
3259-
Response for creating an empty table.
3260-
3261-
**Deprecated**: Use `DeclareTableResponse` instead.
32623187
properties:
32633188
transaction_id:
32643189
type: string
32653190
description: Optional transaction identifier
32663191
location:
32673192
type: string
3193+
version:
3194+
type: integer
3195+
format: int64
3196+
minimum: 0
32683197
storage_options:
32693198
type: object
32703199
description: |
@@ -3276,7 +3205,9 @@ components:
32763205
properties:
32773206
type: object
32783207
description: |
3279-
If the implementation does not support table properties, it should return null for this field. Otherwise it should return the properties.
3208+
Business logic properties stored and managed by the namespace implementation outside
3209+
Lance context. If the implementation does not support table properties, it should
3210+
return null for this field.
32803211
additionalProperties:
32813212
type: string
32823213
example: { "owner": "Ralph", "created_at": "1452120468" }
@@ -3310,7 +3241,8 @@ components:
33103241
properties:
33113242
type: object
33123243
description: |
3313-
Properties stored on the table, if supported by the server.
3244+
Business logic properties stored and managed by the namespace implementation outside
3245+
Lance context, if supported by the implementation.
33143246
additionalProperties:
33153247
type: string
33163248

@@ -5205,13 +5137,6 @@ components:
52055137
schema:
52065138
$ref: "#/components/schemas/DeclareTableResponse"
52075139

5208-
CreateEmptyTableResponse:
5209-
description: Table properties result when creating an empty table
5210-
content:
5211-
application/json:
5212-
schema:
5213-
$ref: "#/components/schemas/CreateEmptyTableResponse"
5214-
52155140
# Error Responses
52165141

52175142
BadRequestErrorResponse:

docs/src/rest/impl-spec.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -654,22 +654,37 @@ Content-Type: application/json
654654

655655
Creates a new table with initial data.
656656

657+
For REST namespace, `CreateTableRequest` fields are passed as follows:
658+
659+
- `id`: path parameter
660+
- `mode`: query parameter
661+
- `properties`: a single JSON-encoded query parameter such as
662+
`properties={"user":"alice","team":"eng"}`; these are business logic properties managed
663+
by the namespace implementation outside Lance context
664+
- `storage_options`: a single JSON-encoded query parameter such as
665+
`storage_options={"aws_region":"us-east-1","timeout":"30s"}`; these configure write-time
666+
overrides for data and metadata written during table creation
667+
657668
**HTTP Request:**
658669

659670
```
660671
POST /v1/table/{id}/create
661-
Content-Type: application/json
672+
Content-Type: application/vnd.apache.arrow.stream
662673
```
663674

664-
### CreateEmptyTable
665-
666-
Creates an empty table with a specified schema.
667-
668-
**HTTP Request:**
675+
**Response:**
669676

670-
```
671-
POST /v1/table/{id}/create-empty
672-
Content-Type: application/json
677+
```json
678+
{
679+
"location": "s3://bucket/data/users.lance",
680+
"version": 1,
681+
"storage_options": {
682+
"aws_region": "us-east-1"
683+
},
684+
"properties": {
685+
"user": "alice"
686+
}
687+
}
673688
```
674689

675690
### GetTableStats

0 commit comments

Comments
 (0)