maurerle / eralchemy2

Entity Relation Diagrams generation tool based on https://github.com/Alexis-benoist/eralchemy
Apache License 2.0
63 stars 15 forks source link

Postgres multiple schemas #18

Closed hoopes closed 1 month ago

hoopes commented 1 year ago

This is a postgres-specific ask, but it would be cool to render more than one schema at once - they're basically namespaces in postgres. I have cross-schema foreign keys, and it would be great to render them.

Let me know if that use-case makes sense. Thanks!

maurerle commented 1 year ago

I don't know how cross-schema foreign keys work with SQLAlchemy. Currently I can only set one schema at the SQLA Automap:

https://github.com/maurerle/eralchemy2/blob/e6a744e34e78be37b8385dcda9dfcd0795cf3668/eralchemy2/sqla.py#L103-L104

I don't think that it works to loop through the schemas to create matching references between the schemas - yet one could try this. If you provide a working example you can send in a PR which will get merged.