I'm trying to make a design with Diagrams but I've ran into an issue which is blocking my progress.
To solve this I would need to do one of three things:
Stop a node from being created when creating assigning the variable (most feasible option I think)
Reuse a variable diagrams variable that's been created in one diagram and reuse it in another diagram (doesn't seem possible. The variable is useable but doesn't seem to do anything when it's referenced in another diagram).
Nest a diagram and assign the variables in the first diagram, while creating the actual diagram in the second one (doesn't seem possible).
I think the most realistic solution would be the first one.
This is basically the part of the code that's causing me issues right now.
Excel sheet with one row containing local IP's and another row containing destination IP's.
workbook = pandas.read_excel("C:/test.xlsx")
from diagrams.aws.compute import EC2
empty dictionary
dic = {}
graph_attr={
"splines": "spline",
}
create the diagram itself going from top to bottom
with Diagram("Web Service", show=True, filename='TEST', direction='TB', graph_attr=graph_attr):
loop over the excel sheet
for i, row in workbook.iterrows():
local_ip = ""
source = row['LOCAL_IP']
destination = row['DESTINATION_IP']
local_hostname_src = row['SOURCE']
Every row gets added to a dictionary. And I create an entry in my dictionary that links this object to a Diagrams object.
I do this so I'm able to reuse the same variable in my script without having 4 different instances of the same object.
The issue I'm running into is that when I run this code: dic[f"{destination}"] = EC2(local_hostname_dst), a node gets created on my diagram. This node is not connected to anything but just stands in the way. Is there a way to assign this variable without anything being created on the diagram itself?
Hello,
I'm trying to make a design with Diagrams but I've ran into an issue which is blocking my progress. To solve this I would need to do one of three things:
I think the most realistic solution would be the first one. This is basically the part of the code that's causing me issues right now.
Excel sheet with one row containing local IP's and another row containing destination IP's.
workbook = pandas.read_excel("C:/test.xlsx")
from diagrams.aws.compute import EC2
empty dictionary
dic = {}
graph_attr={ "splines": "spline", }
create the diagram itself going from top to bottom
with Diagram("Web Service", show=True, filename='TEST', direction='TB', graph_attr=graph_attr):
loop over the excel sheet
Every row gets added to a dictionary. And I create an entry in my dictionary that links this object to a Diagrams object.
I do this so I'm able to reuse the same variable in my script without having 4 different instances of the same object.
The issue I'm running into is that when I run this code: dic[f"{destination}"] = EC2(local_hostname_dst), a node gets created on my diagram. This node is not connected to anything but just stands in the way. Is there a way to assign this variable without anything being created on the diagram itself?
Thanks in advance for your help.