def column_datatype_to_string(cls, sqla_column_type: TypeEngine, dialect: Dialect) -> str: """ Convert sqlalchemy column type to string representation. By default removes collation and character encoding info to avoid unnecessarily long datatypes. :param sqla_column_type: SqlAlchemy column type :param dialect: Sqlalchemy dialect :return: Compiled column type """ sqla_column_type = sqla_column_type.copy() if hasattr(sqla_column_type, "collation"): sqla_column_type.collation = None if hasattr(sqla_column_type, "charset"): sqla_column_type.charset = None return sqla_column_type.compile(dialect=dialect).upper()
def column_datatype_to_string(cls, sqla_column_type: TypeEngine, dialect: Dialect) -> str: """ Convert sqlalchemy column type to string representation. Can be overridden to remove unnecessary details, especially collation info (see mysql, mssql). :param sqla_column_type: SqlAlchemy column type :param dialect: Sqlalchemy dialect :return: Compiled column type """ return sqla_column_type.compile(dialect=dialect).upper()