Typing#
Public type aliases, metadata types, and protocol definitions used throughout SQLSpec.
Optional dependency exports#
The sqlspec.typing and sqlspec._typing modules resolve heavy
optional-dependency symbols lazily. Importing sqlspec does not import
Pydantic, Litestar, PyArrow, pandas, Polars, OpenTelemetry, or Prometheus.
Accessing one of their exported symbols imports its dependency on first use and
caches the resolved object:
import sqlspec.typing as sqlspec_typing
arrow_table_type = sqlspec_typing.ArrowTable # Imports PyArrow here.
When an optional dependency is not installed, the same access returns a stable typed shim. Repeated access returns the identical real object or shim, preserving annotation and runtime identity behavior. Features that require the dependency still raise the normal missing-dependency error when enabled.
msgspec remains eager because its core types and conversion functions are
used throughout result mapping and serialization. orjson also remains on
the existing eager path; both have a small measured import cost compared with
the deferred integrations.