Skip to main content

Commit updates to a table

POST 

/v1/:prefix/namespaces/:namespace/tables/:table

Commit updates to a table.

Commits have two parts, requirements and updates. Requirements are assertions that will be validated before attempting to make and commit changes. For example, assert-ref-snapshot-id will check that a named ref's snapshot ID has a certain value. Server implementations are required to fail with a 400 status code if any unknown updates or requirements are received.

Updates are changes to make to table metadata. For example, after asserting that the current main ref is at the expected snapshot, a commit may add a new child snapshot and set the ref to the new snapshot id.

Create table transactions that are started by createTable with stage-create set to true are committed using this route. Transactions should include all changes to the table, including table initialization, like AddSchemaUpdate and SetCurrentSchemaUpdate. The assert-create requirement is used to ensure that the table was not created concurrently.

Request​

Path Parameters

    prefix stringrequired

    The catalog name in Gravitino, as returned in defaults.prefix by GET /v1/config

    namespace stringrequired

    A namespace identifier as a single string. Multipart namespace parts must be separated by the namespace separator as indicated via the /config override namespace-separator, which defaults to the unit separator 0x1F byte (url encoded %1F). To be compatible with older clients, servers must use both the advertised separator and 0x1F as valid separators when decoding namespaces. The namespace-separator should be provided in a url encoded form.

    Examples:

    Example: accounting

    table stringrequired

    A table name

    Example: sales

Header Parameters

    Idempotency-Key uuid

    Possible values: >= 36 characters and <= 36 characters

    Optional client-provided idempotency key for safe request retries.

    When present, the server ensures no additional effects for requests that carry the same Idempotency-Key. If a prior request with this key has been finalized, the server returns an equivalent final response without re-running the operation. The response body may reflect a newer state of the catalog than existed at the time of the commit.

    Finalization rules:

    • Finalize & replay: 200, 201, 204, and deterministic terminal 4xx (including 409 such as AlreadyExists, NamespaceNotEmpty, etc.)
    • Do not finalize (not stored/replayed): 5xx

    Key Requirements:

    • Key format: UUIDv7 in string form (RFC 9562).
    • The idempotency key must be globally unique (no reuse across different operations).
    • Catalogs SHOULD NOT expire keys before the end of the advertised token lifetime.
    • If Idempotency-Key is used, clients MUST reuse the same key when retrying the same logical operation and MUST generate a new key for a different operation.

Body

required

    identifier

    object

    Table identifier to update; must be present for CommitTransactionRequest

    namespace string[]required

    Reference to one or more levels of a namespace

    name stringrequired

    requirements

    object[]

    required

  • Array [

  • type

    string

    required

    Possible values: [assert-create, assert-table-uuid, assert-ref-snapshot-id, assert-last-assigned-field-id, assert-current-schema-id, assert-last-assigned-partition-id, assert-default-spec-id, assert-default-sort-order-id]

    type stringrequired
  • ]

  • updates

    object[]

    required

  • Array [

  • anyOf

    Assigning a UUID to a table/view should only be done when creating the table/view. It is not safe to re-assign the UUID if a table/view already has a UUID assigned

    action string
    uuid stringrequired

    action

    string

    required

    Possible values: [assign-uuid, upgrade-format-version, add-schema, set-current-schema, add-spec, set-default-spec, add-sort-order, set-default-sort-order, add-snapshot, set-snapshot-ref, remove-snapshots, remove-snapshot-ref, set-location, set-properties, remove-properties, add-view-version, set-current-view-version, set-statistics, remove-statistics, set-partition-statistics, remove-partition-statistics, remove-partition-specs, remove-schemas, add-encryption-key, remove-encryption-key]

    circular(AssignUUIDUpdate)

  • ]

Responses​

Response used when a table is successfully updated. The table metadata JSON is returned in the metadata field. The corresponding file location of table metadata must be returned in the metadata-location field. Clients can check whether metadata has changed by comparing metadata locations.

Response Headers

  • etag

    string

    Identifies a unique version of the table metadata. Implementations that support ETags should produce unique tags for responses that return different metadata content but represent the same version of table metadata. For example, the snapshots query parameter may result in different metadata representations depending on whether refs or all is provided, therefore should have distinct ETags.

Schema

    metadata-location stringrequired

    metadata

    object

    required

    format-version integerrequired

    Possible values: >= 1 and <= 3

    table-uuid stringrequired
    location string
    last-updated-ms int64
    next-row-id int64

    A long higher than all assigned row IDs; the next snapshot's first-row-id.

    properties

    object

    property name* string
    schemas object[]
    current-schema-id integer
    last-column-id integer

    partition-specs

    object[]

  • Array [

  • spec-id integer

    fields

    object[]

    required

  • Array [

  • field-id integer
    source-id integerrequired
    name stringrequired
    transform Transform (string)required
  • ]

  • ]

  • default-spec-id integer
    last-partition-id integer

    sort-orders

    object[]

  • Array [

  • order-id integerrequired

    fields

    object[]

    required

  • Array [

  • source-id integerrequired
    transform Transform (string)required
    direction SortDirection (string)required

    Possible values: [asc, desc]

    null-order NullOrder (string)required

    Possible values: [nulls-first, nulls-last]

  • ]

  • ]

  • default-sort-order-id integer

    encryption-keys

    object[]

  • Array [

  • key-id stringrequired
    encrypted-key-metadata byterequired
    encrypted-by-id string

    properties

    object

    property name* string
  • ]

  • snapshots

    object[]

  • Array [

  • snapshot-id int64required
    parent-snapshot-id int64
    sequence-number int64
    timestamp-ms int64required
    manifest-list stringrequired

    Location of the snapshot's manifest list file

    first-row-id int64

    The first _row_id assigned to the first row in the first data file in the first manifest

    added-rows int64

    The upper bound of the number of rows with assigned row IDs

    summary

    object

    required

    operation stringrequired

    Possible values: [append, replace, overwrite, delete]

    property name* string
    schema-id integer
  • ]

  • refs

    object

    property name*

    SnapshotReference

    type stringrequired

    Possible values: [tag, branch]

    snapshot-id int64required
    max-ref-age-ms int64
    max-snapshot-age-ms int64
    min-snapshots-to-keep integer
    current-snapshot-id int64
    last-sequence-number int64

    snapshot-log

    object[]

  • Array [

  • snapshot-id int64required
    timestamp-ms int64required
  • ]

  • metadata-log

    object[]

  • Array [

  • metadata-file stringrequired
    timestamp-ms int64required
  • ]

  • statistics

    object[]

  • Array [

  • snapshot-id int64required
    statistics-path stringrequired
    file-size-in-bytes int64required
    file-footer-size-in-bytes int64required

    blob-metadata

    object[]

    required

  • Array [

  • type stringrequired
    snapshot-id int64required
    sequence-number int64required
    fields integer[]required

    properties

    object

    property name* string
  • ]

  • ]

  • partition-statistics

    object[]

  • Array [

  • snapshot-id int64required
    statistics-path stringrequired
    file-size-in-bytes int64required
  • ]

Loading...