Background:
- I have a library that describes a database using SQLAlchemy. They have their declarative_base () and MetaData.
- In another project, I have another set of declarative classes that describe some additional tables. They also have their own Base and MetaData.
- Some of these tables have foreign keys that reference tables from the first library.
- SQLAlchemy cannot configure foreign keys or relationships because referenced tables and referenced tables are not in the same metadata (it does not “see” referenced tables)
Questions:
- Is there a way to "merge" tables from the first library into the metadata of the second library?
- Reflecting another database in the second MetaData library almost works, but SQLAlchemy will not recognize that they were displayed declaratively.
- Alternatively, is there a better way to do what I'm trying to do?
source
shareNo one has answered this question yet.
See similar questions:
or similar: