How can I visually model items in a database using python?
I have a Django project that currently models my home network in the admin views. It currently describes what devices there are and what they are connected to. For example:
Devices:
Computer1
Computer2
Laptop1
Mobile1
Router1
ROuter2
ConnectionTypes:
Wireless24ghz
Wireless5ghz
cat5
cat5e
cat6
Connections:
host1:
src:Computer1
dst:Router1
con_type:cat5e
trunk1:
src:Router1
dst:Router2
con_type:cat6
host2:
src:Mobile1
dst:Router1
con_type:Wireless24ghz
The database is a bit more complex than this, however I'm keeping it simple for now as it's not that important.
What I am wondering is, how I can graphically model my network using python code to look at the database tables? By graphically model I mean something similar to a Visio diagram in that I can see it and (not necessary but a HUGE bonus) interact with it, either via webpage or application.
Are there any existing python libraries that provide this sort of functionality? I understand JavaScript is good for this kind of modelling but I'm completely unsure of how I would go about doing it.
It's worth noting I'm not after anything fancy, simply drawing devices as rectangles and connections as lines going between rectangles is good enough.
With the Python script written, you can run it to create the diagram. Start by installing the requirements with Pip: pip3 install -r requirements.
To create a new database diagramIn Object Explorer, right-click the Database Diagrams folder or any diagram in that folder. Choose New Database Diagram on the shortcut menu. The Add Table dialog box appears. Select the required tables in the Tables list and click Add.
I am pretty sure there is no ready solution for this. Look at the graphviz library and make a management command to create a DOT graph. Here is a graphviz tutorial article http://matthiaseisen.com/articles/graphviz/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With