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

Draw column relations #72

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Conversation

JosePVB
Copy link

@JosePVB JosePVB commented May 24, 2020

This PR takes advantage of Graphviz support for the PORT attribute on HTML-like labels, to draw the relationships between the specific columns in tables, as opposed to arbitrarily linking the tables together. See https://www.graphviz.org/doc/info/shapes.html#html for more information.

This PR addresses issue #55. It includes the initial work to support this feature, done by @sersorrel. I then added support for this feature in the Markdown output and updated the existing tests.

Below is an example of the what the newsmeme ER diagram looks like with these changes.

newsmeme-1

self.left_col,
return '{}{} {}--{} {}{}'.format(
self.left_table,
'' if self.left_column is None else '."%s"' % self.left_column,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Column names are wrapped in double quotes so that .er files generated prior to these changes can still be parsed correctly. Without some special column delimiter, it would be hard to distinguish the cases for foo.bar, where foo could either be a schema or table name, and bar could be a table or column name.

@davidjb99 davidjb99 mentioned this pull request Nov 4, 2021
@12rambau
Copy link
Collaborator

12rambau commented Jul 4, 2024

Hi @JosePVB I really like this approach as it make the relationship between classes even clearer !
Are you still around and ready to contribute to this repository or should we reboot your work on the latest iteration of the package ?

@maurerle
Copy link
Collaborator

maurerle commented Jul 4, 2024

This looks very nice - I somehow missed it.
A related Issue exists on my fork: maurerle/eralchemy2#30

Would be good to have this as an option in the future :)

@maurerle
Copy link
Collaborator

maurerle commented Jul 13, 2024

I just merged main into this branch and improved the PR - the resulting run from python example/newsmeme.py looks like this:
newsmeme

Also reflecting the improved cardinalities - though it still does not look fully right.
When running eralchemy -i example/newsmeme.er -o er.svg I still get some warnings from Agraph which need to be fixed..

Tests are also failing currently

@maurerle maurerle mentioned this pull request Jul 13, 2024
@maurerle maurerle force-pushed the draw-column-relations branch 2 times, most recently from 77d6ff4 to 7030b3f Compare September 16, 2024 23:42
Draw relations between specific columns rather than just between the tables (because when there are multiple
relations between two tables, that ends up looking very messy).
@maurerle maurerle force-pushed the draw-column-relations branch from 7030b3f to 8fa193e Compare September 16, 2024 23:49
@maurerle maurerle merged commit 74d7bee into eralchemy:main Sep 16, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

3 participants