I do a lot of introspection of the database for different types of databases, and I would like to compare two types of columns. For example, a field that is defined as Booleanusing declarative_base()is then converted to a MySQL- specific TINYINTdialog , so check as follows:
model_a.__table__.columns['col'].type == model_b.__table__.columns['col'].type
does not work, and not one of them:
(type_a == type_b) or issubclass(type_b, type_a)
How to compare two columns for the "affinity" data type? (While checking the code, I saw that the column types have a class Comparator, but I'm not sure if it can help and how to use it) Can I also force the column type in the SQLAlchemy configuration (avoiding dialect-dependent conversions)?
source
share