Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eralchemy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Data
forks
eralchemy
Commits
f27b2520
Unverified
Commit
f27b2520
authored
Feb 13, 2018
by
Tony Hirst
Committed by
Florian Maurer
Aug 8, 2024
Browse files
Options
Downloads
Patches
Plain Diff
Move from pygraphviz to graphviz
parent
ec80be3b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
eralchemy/main.py
+14
-14
14 additions, 14 deletions
eralchemy/main.py
tests/test_intermediary_to_dot.py
+1
-1
1 addition, 1 deletion
tests/test_intermediary_to_dot.py
with
15 additions
and
15 deletions
eralchemy/main.py
+
14
−
14
View file @
f27b2520
...
...
@@ -5,7 +5,8 @@ import re
import
sys
from
importlib.metadata
import
PackageNotFoundError
,
version
from
pygraphviz.agraph
import
AGraph
#from pygraphviz.agraph import AGraph
from
graphviz
import
Source
from
sqlalchemy.engine.url
import
make_url
from
sqlalchemy.exc
import
ArgumentError
...
...
@@ -139,10 +140,12 @@ def intermediary_to_dot(tables, relationships, output, title=""):
def
intermediary_to_schema
(
tables
,
relationships
,
output
,
title
=
""
):
"""
Transforms and save the intermediary representation to the file chosen.
"""
dot_file
=
_intermediary_to_dot
(
tables
,
relationships
,
title
)
graph
=
AGraph
()
graph
=
graph
.
from_string
(
dot_file
)
extension
=
output
.
split
(
"
.
"
)[
-
1
]
graph
.
draw
(
path
=
output
,
prog
=
"
dot
"
,
format
=
extension
)
#graph = AGraph()
#graph = graph.from_string(dot_file)
extension
=
output
.
split
(
'
.
'
)[
-
1
]
#graph.draw(path=output, prog='dot', format=extension)
#Source.from_file(filename, engine='dot', format=extension)
return
Source
(
dot_file
,
engine
=
'
dot
'
,
format
=
extension
)
def
_intermediary_to_markdown
(
tables
,
relationships
):
...
...
@@ -363,16 +366,13 @@ def render_er(
"""
try
:
tables
,
relationships
=
all_to_intermediary
(
input
,
schema
=
schema
)
tables
,
relationships
=
filter_resources
(
tables
,
relationships
,
include_tables
=
include_tables
,
include_columns
=
include_columns
,
exclude_tables
=
exclude_tables
,
exclude_columns
=
exclude_columns
,
)
if
include
is
not
None
:
tables
,
relationships
=
filter_includes
(
tables
,
relationships
,
include
)
if
exclude
is
not
None
:
tables
,
relationships
=
filter_excludes
(
tables
,
relationships
,
exclude
)
intermediary_to_output
=
get_output_mode
(
output
,
mode
)
intermediary_to_output
(
tables
,
relationships
,
output
,
title
)
out
=
intermediary_to_output
(
tables
,
relationships
,
output
)
return
out
except
ImportError
as
e
:
module_name
=
e
.
message
.
split
()[
-
1
]
print
(
f
'
Please install
{
module_name
}
using
"
pip install
{
module_name
}
"
.
'
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_intermediary_to_dot.py
+
1
−
1
View file @
f27b2520
...
...
@@ -30,7 +30,7 @@ column_inside = re.compile(
"
(?P<key_closing>.*)
\\
<FONT
\\
>
\\
\\
[(?P<type>.*)
\\
]
\\
<
\\
/FONT
\\
>
"
,
)
#This test needs fixing with move to graphviz
def
assert_is_dot_format
(
dot
):
"""
Checks that the dot is usable by graphviz.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment