Skip to content

Commit b6fca0d

Browse files
committed
codegen: create table
1 parent 679ff35 commit b6fca0d

File tree

1 file changed

+316
-0
lines changed

1 file changed

+316
-0
lines changed

spec/catalog.yaml

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,42 @@ paths:
9191
5XX:
9292
$ref: '#/components/responses/ServerErrorResponse'
9393

94+
/v1/namespaces/{ns}/tables:
95+
post:
96+
tags: [ Table ]
97+
summary: >
98+
Create a new table in the given namespace. A table represents a lance dataset.
99+
In Lance catalog, a table must be hosted in a namespace.
100+
operationId: CreateTable
101+
parameters:
102+
- $ref: '#/components/parameters/ns'
103+
requestBody:
104+
required: true
105+
content:
106+
application/json:
107+
schema:
108+
$ref: '#/components/schemas/CreateTableRequest'
109+
responses:
110+
200:
111+
$ref: '#/components/responses/CreateTableResponse'
112+
400:
113+
$ref: '#/components/responses/BadRequestErrorResponse'
114+
403:
115+
$ref: '#/components/responses/ForbiddenResponse'
116+
406:
117+
$ref: '#/components/responses/UnsupportedOperationResponse'
118+
503:
119+
$ref: '#/components/responses/ServiceUnavailableResponse'
120+
5XX:
121+
$ref: '#/components/responses/ServerErrorResponse'
122+
94123
components:
124+
parameters:
125+
ns:
126+
name: ns
127+
in: path
128+
required: true
129+
schema: { type: string }
95130

96131
schemas:
97132
ErrorModel:
@@ -150,6 +185,272 @@ components:
150185
example: { "created_at": "1452120468" }
151186
default: { }
152187

188+
CreateTableRequest:
189+
type: object
190+
required: [ name, definition ]
191+
properties:
192+
name: { type: string }
193+
definition:
194+
$ref: '#/components/schemas/TableDefinition'
195+
mode:
196+
type: string
197+
enum: [ Create, ExistOk, Overwrite ]
198+
write_options:
199+
type: object
200+
additionalProperties: true
201+
description: Optional write options for the table creation.
202+
nullable: true
203+
204+
TableDefinition:
205+
type: object
206+
required: [ column_definitions, schema ]
207+
properties:
208+
column_definitions:
209+
type: array
210+
items:
211+
$ref: '#/components/schemas/ColumnDefinition'
212+
schema:
213+
$ref: '#/components/schemas/Schema'
214+
215+
ColumnDefinition:
216+
type: object
217+
required: [ kind ]
218+
properties:
219+
kind:
220+
$ref: '#/components/schemas/ColumnKind'
221+
222+
ColumnKind:
223+
type: string
224+
enum: [ Physical, Embedding ]
225+
226+
Schema:
227+
type: object
228+
required: [ fields, metadata ]
229+
properties:
230+
fields:
231+
type: array
232+
items:
233+
$ref: '#/components/schemas/Field'
234+
metadata:
235+
type: object
236+
additionalProperties: { type: string }
237+
238+
Field:
239+
type: object
240+
required: [ name, data_type, nullable, dict_id, dict_is_ordered, metadata ]
241+
properties:
242+
name: { type: string }
243+
data_type:
244+
$ref: '#/components/schemas/DataType'
245+
nullable: { type: boolean }
246+
dict_id:
247+
type: integer
248+
format: int64
249+
deprecated: true
250+
dict_is_ordered: { type: boolean }
251+
metadata:
252+
type: object
253+
additionalProperties: { type: string }
254+
255+
DataType:
256+
oneOf:
257+
- enum: [ Null, Boolean, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float16, Float32, Float64, Date32, Date64, Binary, LargeBinary, BinaryView, Utf8, LargeUtf8, Utf8View ]
258+
type: string
259+
description: Primitive data types
260+
261+
- type: object
262+
required: [ type ]
263+
properties:
264+
type:
265+
type: string
266+
enum: [ Timestamp ]
267+
time_unit:
268+
$ref: '#/components/schemas/TimeUnit'
269+
timezone:
270+
type: string
271+
nullable: true
272+
description: Timestamp with time unit and optional timezone
273+
274+
- type: object
275+
required: [ type, time_unit ]
276+
properties:
277+
type:
278+
type: string
279+
enum: [ Time32, Time64, Duration ]
280+
time_unit:
281+
$ref: '#/components/schemas/TimeUnit'
282+
283+
- type: object
284+
required: [ type, interval_unit ]
285+
properties:
286+
type:
287+
type: string
288+
enum: [ Interval ]
289+
interval_unit:
290+
$ref: '#/components/schemas/IntervalUnit'
291+
292+
- type: object
293+
required: [ type, size ]
294+
properties:
295+
type:
296+
type: string
297+
enum: [ FixedSizeBinary ]
298+
size:
299+
type: integer
300+
format: int32
301+
302+
- type: object
303+
required: [ type ]
304+
properties:
305+
type:
306+
type: string
307+
enum: [ List ]
308+
element:
309+
$ref: '#/components/schemas/Field'
310+
311+
- type: object
312+
required: [ type ]
313+
properties:
314+
type:
315+
type: string
316+
enum: [ ListView ]
317+
element:
318+
$ref: '#/components/schemas/Field'
319+
320+
- type: object
321+
required: [ type, size ]
322+
properties:
323+
type:
324+
type: string
325+
enum: [ FixedSizeList ]
326+
element:
327+
$ref: '#/components/schemas/Field'
328+
size:
329+
type: integer
330+
format: int32
331+
332+
- type: object
333+
required: [ type ]
334+
properties:
335+
type:
336+
type: string
337+
enum: [ LargeList ]
338+
element:
339+
$ref: '#/components/schemas/Field'
340+
341+
- type: object
342+
required: [ type ]
343+
properties:
344+
type:
345+
type: string
346+
enum: [ LargeListView ]
347+
element:
348+
$ref: '#/components/schemas/Field'
349+
350+
- type: object
351+
required: [ type ]
352+
properties:
353+
type:
354+
type: string
355+
enum: [ Struct ]
356+
fields:
357+
type: array
358+
items:
359+
$ref: '#/components/schemas/Field'
360+
361+
- type: object
362+
required: [ type ]
363+
properties:
364+
type:
365+
type: string
366+
enum: [ Union ]
367+
union_fields:
368+
$ref: '#/components/schemas/UnionFields'
369+
union_mode:
370+
$ref: '#/components/schemas/UnionMode'
371+
372+
- type: object
373+
required: [ type ]
374+
properties:
375+
type:
376+
type: string
377+
enum: [ Dictionary ]
378+
key_type:
379+
$ref: '#/components/schemas/DataType'
380+
value_type:
381+
$ref: '#/components/schemas/DataType'
382+
383+
- type: object
384+
required: [ type, precision, scale ]
385+
properties:
386+
type:
387+
type: string
388+
enum: [ Decimal128 ]
389+
precision:
390+
type: integer
391+
format: uint8
392+
minimum: 1
393+
maximum: 38
394+
scale:
395+
type: integer
396+
format: int8
397+
398+
- type: object
399+
required: [ type, precision, scale ]
400+
properties:
401+
type:
402+
type: string
403+
enum: [ Decimal256 ]
404+
precision:
405+
type: integer
406+
format: uint8
407+
minimum: 1
408+
maximum: 76
409+
scale:
410+
type: integer
411+
format: int8
412+
413+
- type: object
414+
required: [ type ]
415+
properties:
416+
type:
417+
type: string
418+
enum: [ Map ]
419+
key_sorted:
420+
type: boolean
421+
element:
422+
$ref: '#/components/schemas/Field'
423+
424+
- type: object
425+
required: [ type ]
426+
properties:
427+
type:
428+
type: string
429+
enum: [ RunEndEncoded ]
430+
run_ends:
431+
$ref: '#/components/schemas/Field'
432+
values:
433+
$ref: '#/components/schemas/Field'
434+
435+
TimeUnit:
436+
type: string
437+
enum: [ Second, Millisecond, Microsecond, Nanosecond ]
438+
description: Time unit for temporal types
439+
440+
IntervalUnit:
441+
type: string
442+
enum: [ YearMonth, DayTime, MonthDayNano ]
443+
description: Interval units
444+
445+
UnionMode:
446+
type: string
447+
enum: [ Sparse, Dense ]
448+
449+
UnionFields:
450+
type: array
451+
items:
452+
$ref: '#/components/schemas/Field'
453+
153454
responses:
154455
CreateNamespaceResponse:
155456
description:
@@ -166,6 +467,21 @@ components:
166467
"properties": { "created_at": "1452120468" }
167468
}
168469

470+
CreateTableResponse:
471+
type: object
472+
required:
473+
- name
474+
properties:
475+
name: { type: string }
476+
properties:
477+
type: object
478+
additionalProperties:
479+
type: string
480+
description:
481+
Properties stored on the table, if supported by the server.
482+
example: { "created_at": "1452120468" }
483+
default: { }
484+
169485
BadRequestErrorResponse:
170486
description:
171487
Indicates a bad request error. It could be caused by an unexpected request

0 commit comments

Comments
 (0)