tedivm / paracelsus

Visualize SQLAlchemy Databases using Mermaid or Dot Diagrams.
https://pypi.org/project/paracelsus/
MIT License
94 stars 10 forks source link

Keep only a subset of the import models #15

Closed aja114 closed 5 months ago

aja114 commented 5 months ago

It would be useful to have the ability to select only a subset of models. Currently the way to select them is by importing the module where a model is defined which will register it into the metadata object. If all the models are already imported in the __init__ then they will all be registered in metadata and by default will be added to the graph. Having filters (--white-list, --black-list maybe) on which model is displayed would be quite useful to obtain a subset of the graph.

I imagine that this can generate errors based on relationship which I guess should be clearly reported to the user.

tedivm commented 5 months ago

I'm super open to this. The only difference I would make is using --exclude-table and --include-table (with the ability to call the flag multiple times) for the flag names. I can definitely see a use case where people would only want to see specific tables, or may want to exclude some.

aja114 commented 5 months ago

Thanks for the reply :) I have added a draft PR for this, feel free to add comments about how you envisioned this.

tedivm commented 5 months ago

Sounds good! I added some feedback in, and should be able to review any changes over the weekend as they come through.

tedivm commented 5 months ago

Resolved by #16