Hi,
I'm using SQLAlchemy and am generating classes dynamically for my database via the Automapping functionality.
I need to add a Mixin class with various helper methods to each of these automapped classes.
I tried to create subclasses of the automapped class with the mixin class:
db = create_engine(connection_string)but when I try to use these classes I get errors like:
class _ is a subclass of AutomapBase. Mappings are not produced until the .prepare() method is called on the class hierarchy.If I call automapper.prepare() again, I get warnings like this and mostly just enters an infinite loop:
SAWarning: This declarative base already contains a class with the same class name and module name as sqlalchemy.ext.automap.payments, and will be replaced in the string-lookup table.I cannot specify the database classes explicitly as in the documentation, because I don't know the database tables ahead of time (I'll be connecting to databases dynamically given a connection string).
Any thoughts?
thank you