Giter Site home page Giter Site logo

Comments (5)

jayqi avatar jayqi commented on June 18, 2024

Hi @otyrrell,

Strange! I did not have an issue with your example.

A

(Note that your code is not quite fully reproducible. You're missing a BaseModel import and a List import.)

Can you provide the output of erd.create(A).to_dot()?

As well, can you provide the version of Pydantic, Pygraphviz, and Graphviz that you are using?


EDIT: I am noticing though that my version is missing the O so something is still a little wacky here...

from erdantic.

otyrrell avatar otyrrell commented on June 18, 2024

Sorry, I didn't copy the full code, please see full segment below:

import erdantic as erd
from erdantic.examples.pydantic import Party
from typing import List
from pydantic import BaseModel

# Easy one-liner
erd.draw(Party, out="diagram.png")


class B(BaseModel):
    """
    B Class
    """

    id: str


class A(BaseModel):
    """
    A Class
    """

    list_b: List[B]


erd.draw(A, out="A.jpg")
result = erd.create(A).to_dot()
print(result)

This provides the output:

digraph "Entity Relationship Diagram" {
        graph [fontcolor=gray66,
                fontsize=9,
                label="Created by erdantic v0.6.0 <https://github.com/drivendataorg/erdantic>",
                nodesep=0.5,
                rankdir=LR,
                ranksep=1.5
        ];
        node [fontsize=14,
                label="\N",
                shape=plain
        ];
        "__main__.A"    [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>A</b></td></tr><tr><td>list_b</td><td port="list_b">List[B]</td></tr></table>>,
                tooltip="__main__.A&#xA;&#xA;A Class&#xA;"];
        "__main__.B"    [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>B</b></td></tr><tr><td>id</td><td port="id">str</td></tr></table>>,
                tooltip="__main__.B&#xA;&#xA;B Class&#xA;"];
        "__main__.A":list_b:e -> "__main__.B":_root:w   [arrowhead=crowodot];
}

Name: erdantic
Version: 0.6.0
Name: pydantic
Version: 2.3.0
Name: pygraphviz
Version: 1.11
GraphViz version 9.0.0 on Windows 10 x64

Only other thing I found is that it seems very specific to crow notation; when I changed "crow" to "icurve" on line 55 in erd.py it all works as expected (although showing the curve notation not the required crows foot)

from erdantic.

jayqi avatar jayqi commented on June 18, 2024

The DOT output looks like what I expect, and copy-pasting it into this online renderer seems to produce the expected image. https://dreampuf.github.io/GraphvizOnline

So that suggests something funky is happening at the pygraphviz/graphviz level. Will find some time to dig into this more.

from erdantic.

otyrrell avatar otyrrell commented on June 18, 2024

Thank you for clarifying. I agree it does appear to be some sort of bug/unexpected behaviour within pygraphviz/graphviz. I couldn't find any relevant reports of crow foot notation having issues. I guess next step is understanding whether it is in the graphviz or the pygraphviz layer?

from erdantic.

jayqi avatar jayqi commented on June 18, 2024

I'm not seeing this anymore with pygraphviz 1.12, graphviz 9.0.0. Closing as resolved unless there are additional details provided.

from erdantic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.