这个错误通常是因为Redshift没有实现文本版本控制所需的SQLAlchemy方法。为解决这个问题,您需要强制Alembic使用PostgreSQL编译器来转换DDL语句。您可以在Alembic配置文件中添加以下行来实现此目的:
from alembic.ddl.postgresql import PGCompiler context = MigrationContext.configure(connection=connection, target_metadata=target_metadata, compiler=PGCompiler()) 改变这些行,以便它们与您自己的配置文件实际上匹配。这应该解决您遇到的问题。