helix_ir.ddl¶
helix_ir.ddl — DDL generation for multiple SQL dialects.
- helix_ir.ddl.compile_ddl(schema_or_plan: Any, dialect: str = 'duckdb', options: DDLOptions | None = None) DDLScript[source]¶
Compile a Schema or NormalizationPlan to a DDL script.
- Parameters:
schema_or_plan – A Schema instance or NormalizationPlan instance.
dialect – Target SQL dialect name.
options – DDL generation options.
- Returns:
A DDLScript with all CREATE TABLE statements.
- helix_ir.ddl.compile_migration(schema_diff: SchemaDiff, dialect: str = 'duckdb', table_name: str | None = None, options: DDLOptions | None = None, skip_breaking: bool = False) DDLScript[source]¶
Compile a SchemaDiff into ALTER TABLE migration statements.
- Parameters:
schema_diff – The diff between old and new schema.
dialect – Target SQL dialect.
table_name – Table name to alter. Defaults to schema_diff.new_name.
options – DDL options.
skip_breaking – If True, skip breaking changes (dangerous!).
- Returns:
A DDLScript with ALTER TABLE statements.
- class helix_ir.ddl.DDLOptions(if_not_exists: bool = True, include_comments: bool = True, primary_key: str | None = '__id', schema_prefix: str | None = None, extra_options: dict[str, ~typing.Any]=<factory>)[source]¶
Bases:
objectOptions controlling DDL generation.