as_polyglot_schema: Specify a table schema for schema-aware operations

View source: R/schema.R

as_polyglot_schemaR Documentation

Specify a table schema for schema-aware operations

Description

Several polyglotSQL functions (sql_validate(), sql_lineage(), sql_analyze(), sql_optimize(), sql_annotate_types(), sql_openlineage()) accept an optional schema argument describing the tables referenced by the query. A schema enables column qualification, type inference, and existence checks.

Usage

as_polyglot_schema(schema)

Arguments

schema

A schema specification (named list as described above), or NULL for no schema.

Details

A schema is a named list with one entry per table. Each entry is either:

  • a named character vector mapping column names to SQL types, e.g. c(id = "INT", name = "TEXT");

  • an unnamed character vector of column names (types unknown), e.g. c("id", "name").

Value

A JSON string in the upstream ValidationSchema format, or "" when schema is NULL. Mostly used internally; exported for advanced users who want to inspect the generated payload.

Examples

as_polyglot_schema(list(
  orders = c(o_id = "INT", o_total = "DECIMAL(10,2)"),
  users = c("id", "name")
))

polyglotSQL documentation built on Sept. 27, 2026, 5:06 p.m.