Skip to main content

Schema and Table Metadata

Many of the more ergonomic row helpers in this SDK start by loading table metadata and schema information.

That pattern is visible in both the lightweight dev harness and the broader E2E suite.

Inspect a Table​

table := cli.Table(client.TablePath{
DatabaseName: "fluss",
TableName: "orders",
})

info, err := table.Info(ctx)
if err != nil {
log.Fatal(err)
}

schemaInfo, err := table.Schema(ctx, nil)
if err != nil {
log.Fatal(err)
}

Why Schema Loading Matters​

The public row helpers work best when you convert schema JSON into Go-friendly structures once and reuse them.

The dev harness does that with:

  • client.ParseSchemaColumns(...)
  • client.NewSchemaFromColumns(...)
  • field-name extraction for formatted output and row building

That looks like:

columns, err := client.ParseSchemaColumns(schemaInfo.JSON)
if err != nil {
log.Fatal(err)
}

schema := client.NewSchemaFromColumns(columns)

Typical Usage Pattern​

For write and decode flows, the common sequence is:

  1. load TableInfo
  2. load SchemaInfo
  3. parse columns from schemaInfo.JSON
  4. build a client.Schema
  5. use that schema for row construction, decode helpers, or writer bootstrap

What Metadata Is Used For​

The SDK uses metadata for:

  • table ID and schema ID resolution
  • bucket routing
  • key-column and bucket-column decisions
  • Arrow compression settings
  • writer bootstrap state

This is why helper-first flows such as BootstrapRowWriter(...) and the Auto helpers are often easier to use correctly than lower-level raw batch APIs.