compiler: DDLCompiler,
default: Optional[_ServerDefault],
) -> str:
- return compiler.get_column_default_string(
+ # this can be updated to use compiler.render_default_string
+ # for SQLAlchemy 2.0 and above; not in 1.4
+ default_str = compiler.get_column_default_string(
Column("x", Integer, server_default=default)
)
+ assert default_str is not None
+ return default_str
def format_type(compiler: DDLCompiler, type_: TypeEngine) -> str:
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.sql import ClauseElement
from sqlalchemy.sql import Executable
- from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy.sql.elements import quoted_name
from sqlalchemy.sql.schema import Constraint
from sqlalchemy.sql.schema import ForeignKeyConstraint
def drop_table_comment(self, table: Table) -> None:
self._exec(schema.DropTableComment(table))
- def create_column_comment(self, column: ColumnElement[Any]) -> None:
+ def create_column_comment(self, column: Column[Any]) -> None:
self._exec(schema.SetColumnComment(column))
def drop_index(self, index: Index, **kw: Any) -> None: