We have a few thousand databases, but the number of columns are not consistent.
Is it possible to define columns that may or may not appear in the table?
As example:
class ContactFields(Model):
id = IntegerField()
id_2 = IntegerField()
Sometimes id_2 does not exist. However, if I try to create a query, peewee errors out with:
InternalError: (1054, "Unknown column 't1.id_2' in 'field list'")
No, that would be magical as hell. You can try using reflection if you need to dynamically access tables. Or you can just explicitly select only those columns which are present across all databases.
http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#generate_models