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

Correct typos, change default output extensions and replace invalid characters from node name #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Oct 13, 2021

No description provided.

ba-tno added 3 commits October 13, 2021 17:55
Typo in concentrate option, semi-colons are not accepted in brackets, default extension for grapvhiz files is .gv or .dot.
Grapvhiz does not like dashes in node names, therefore I replace them with underscores
@@ -196,7 +195,7 @@ def create_rel(self, left_table_name, right_table_name, left_on=None, right_on=N
self.table_gen_code.append(rel)


def write_to_file(self, filename='output.txt'):
def write_to_file(self, filename='output.gv'):
Copy link
Owner

Choose a reason for hiding this comment

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

i was using the output.txt to paste into a graphviz renderer. is this change so that you can just render it locally?

Copy link
Author

Choose a reason for hiding this comment

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

To be honest I cannot recall why I made this change specifically. Probably because .gv is a standard extension for Grapvhiz DOT files. Likely I was using another tool that would pick up .gv files and render them.

Choose a reason for hiding this comment

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

Yep, .gv is the correct Graphviz DOT files. Graphviz is imported, but not sure if it's on the build yet...

Copy link

Choose a reason for hiding this comment

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

If the output is saved as a .gv file, graphviz library can be used to display it on the screen if using a notebook and can also be used to save it, as a png in this example.

...
raw_entity_relationship_diagram.write_to_file('raw_entity_relationship_diagram.gv')
graph = graphviz.Source.from_file('raw_entity_relationship_diagram.gv')
graph.render('erd_raw', format='png') #Save file
display(graph)

@@ -39,6 +40,7 @@ def __construct__(self):
table_end = '\t\t' + '</table>>];'
self.table_def.append(self.front_matter)
for col, col_type in self.meta_info:
col = col.replace("-", "_")

Choose a reason for hiding this comment

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

HAHAHA! Someone has been playing with AWS Athena, @ba-tno ? ;)

fontname="Helvetica";
nodesep=0.5,
rankdir="LR",
concentrate=true,

Choose a reason for hiding this comment

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

Good catch.

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