Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding models from diagram #128

Open
jayqi opened this issue Sep 23, 2024 · 1 comment
Open

Excluding models from diagram #128

jayqi opened this issue Sep 23, 2024 · 1 comment

Comments

@jayqi
Copy link
Member

jayqi commented Sep 23, 2024

I have one addtional question, you may could answer: Asumming a pydantic class structure, is it possible to exclude classes? I know its possible to definde end-points via terminal_models, but in our case each class have an attribute of type "AttributeData", which we want to disable when drawing the diagram.
Thanks in advance.

Originally posted by @SebastianDD in #124 (comment)

@jayqi
Copy link
Member Author

jayqi commented Sep 23, 2024

There isn't currently a convenient interface for specifying certain models to be excluded.

However, here are some ways you can accomplish this:

  1. Delete the models from the diagram after the diagram is created but before rendering. You can go through the models dictionary or edges list on the EntityRelationshipDiagram class and remove nodes and edges. See some relevant documentation here.
  2. Use a custom plugin with custom predicate logic. You can create a custom plugin that handles the logic for excluding those particular model classes and register it overriding the built-in pydantic one. Relevant documentation here. An easy way to accomplish your goal is to just create a new function that wraps is_pydantic_model with your extra exclusion logic, and register that along with the built-in get_fields_from_pydantic_model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant