DDL Generation¶
DDL generation is handled by TiberoDDLCompiler and TiberoTypeCompiler.
CREATE TABLE column specification¶
TiberoDDLCompiler.get_column_specification() builds each column as:
- Formatted column name
- Compiled Tibero type
NOT NULLwhen applicable- Identity or default clause
Identity behavior:
- If column is the table autoincrement column and has no server default, emit:
- Otherwise, emit explicit
DEFAULT <expr>if present.
Table comments¶
Supported comment methods:
post_create_table(table)appendsCOMMENT ON TABLE ...visit_set_table_comment(create, **kw)visit_drop_table_comment(drop, **kw)
Example emitted SQL:
Column comments¶
visit_set_column_comment(create, **kw) emits:
Sequences¶
The dialect advertises supports_sequences = True and sequences_optional = True, so SQLAlchemy sequence constructs are supported.
DDL compilation flow¶
mermaid
flowchart LR
model[Table/Column metadata] --> ddl[TiberoDDLCompiler]
ddl --> typec[TiberoTypeCompiler]
typec --> sql[CREATE/ALTER/COMMENT SQL]
sql --> exec[DB-API execution via engine]
Comments are emitted separately
inline_comments = False, so comments are produced as standalone COMMENT ON statements.
Identity condition is strict
Identity SQL is only emitted for SQLAlchemy's detected autoincrement column with no explicit server default.
Alembic Migration Support¶
This dialect ships with an Alembic DDLImpl registered via alembic.ddl entry point. After installing
sqlalchemy-pytibero, Alembic migrations work automatically.
Key behavior: transactional_ddl = False — Tibero auto-commits DDL statements, so Alembic will not
wrap migrations in a transaction.
Install Alembic extra
pip install "sqlalchemy-pytibero[alembic]" to pull in Alembic as a dependency.