maurerle / eralchemy2

Entity Relation Diagrams generation tool - DEPRECATED
https://github.com/eralchemy/eralchemy
Apache License 2.0
70 stars 17 forks source link

SQLAlchemy 2 DeclarativeBase is not supported #19

Closed kasium closed 1 year ago

kasium commented 1 year ago

When using render_er with a class extending DeclarativeBase an error is raised, because switch_input_class_to_method cannot handle DeclarativeAttributeIntercept. I'm happy to give a PR a try

maurerle commented 1 year ago

Do you have a short example which uses this? Would be cool, if you could submit it along to a PR for it :+1:

But just a small example would help too!

kasium commented 1 year ago

Sure. You can find an offical example here: https://docs.sqlalchemy.org/en/20/orm/mapping_styles.html#declarative-mapping. I solved it local with this code

from eralchemy2 import main as eralchemy2_main
eralchemy2_main.switch_input_class_to_method[
        "DeclarativeAttributeIntercept"
] = eralchemy2_main.declarative_to_intermediary