Module

data.schema.parse

Schema parser — parse desired schema SQL into a SchemaSnapshot.

Parses CREATE TABLE and CREATE INDEX statements from SQL text.

Functions

_parse_column_def 2 tuple[ColumnSchema | Non…
Parse a single column definition.
def _parse_column_def(col_def: str, table_name: str) -> tuple[ColumnSchema | None, ForeignKey | None]
Parameters
Name Type Description
col_def str
table_name str
Returns
tuple[ColumnSchema | None, ForeignKey | None]
_split_column_defs 1 list[str]
Split column definitions handling nested parentheses.
def _split_column_defs(body: str) -> list[str]
Parameters
Name Type Description
body str
Returns
list[str]
parse_schema 1 SchemaSnapshot
Parse SQL schema text into a SchemaSnapshot. Supports CREATE TABLE and CREATE …
def parse_schema(sql: str) -> SchemaSnapshot

Parse SQL schema text into a SchemaSnapshot.

Supports CREATE TABLE and CREATE INDEX statements.

Parameters
Name Type Description
sql str
Returns
SchemaSnapshot