I have the following class definition that I would like to make dynamic:
class SQLModel_custom(SQLModel, registry=self.mapper_registry):
metadata = MetaData(schema=self.schema)
I've tried something like that:
type('SQLModel_custom', (SQLModel, self.mapper_registry), {'metadata': MetaData(schema=self.schema)})
But this give me the following error:
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Maybe the issue comes from the fact I'm not using registry=
when defining parent classes in the dynamic version, but I don't see how I could acheive the same result.
Any advice? Thank you!