Update entity_relationship_generator.py
Browse files
entity_relationship_generator.py
CHANGED
|
@@ -244,7 +244,7 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
| 244 |
if not entity_name:
|
| 245 |
raise ValueError(f"Invalid entity: {entity}")
|
| 246 |
|
| 247 |
-
entity_label = f"
|
| 248 |
|
| 249 |
if attributes:
|
| 250 |
entity_label += "|"
|
|
@@ -261,11 +261,11 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
| 261 |
|
| 262 |
if attr_type == 'primary_key':
|
| 263 |
if is_multivalued:
|
| 264 |
-
primary_keys.append(f"
|
| 265 |
else:
|
| 266 |
-
primary_keys.append(f"
|
| 267 |
elif attr_type == 'foreign_key':
|
| 268 |
-
foreign_keys.append(f"
|
| 269 |
else:
|
| 270 |
attr_display = attr_name
|
| 271 |
if is_derived:
|
|
@@ -292,7 +292,7 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
| 292 |
|
| 293 |
dot.node(
|
| 294 |
entity_name,
|
| 295 |
-
|
| 296 |
shape=shape,
|
| 297 |
style=style,
|
| 298 |
fillcolor=fillcolor,
|
|
@@ -326,7 +326,7 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
| 326 |
|
| 327 |
dot.node(
|
| 328 |
rel_name,
|
| 329 |
-
|
| 330 |
shape=rel_shape,
|
| 331 |
style=rel_style,
|
| 332 |
fillcolor=rel_color,
|
|
|
|
| 244 |
if not entity_name:
|
| 245 |
raise ValueError(f"Invalid entity: {entity}")
|
| 246 |
|
| 247 |
+
entity_label = f"{entity_name}"
|
| 248 |
|
| 249 |
if attributes:
|
| 250 |
entity_label += "|"
|
|
|
|
| 261 |
|
| 262 |
if attr_type == 'primary_key':
|
| 263 |
if is_multivalued:
|
| 264 |
+
primary_keys.append(f"PK: {{ {attr_name} }}")
|
| 265 |
else:
|
| 266 |
+
primary_keys.append(f"PK: {attr_name}")
|
| 267 |
elif attr_type == 'foreign_key':
|
| 268 |
+
foreign_keys.append(f"FK: {attr_name}")
|
| 269 |
else:
|
| 270 |
attr_display = attr_name
|
| 271 |
if is_derived:
|
|
|
|
| 292 |
|
| 293 |
dot.node(
|
| 294 |
entity_name,
|
| 295 |
+
entity_label,
|
| 296 |
shape=shape,
|
| 297 |
style=style,
|
| 298 |
fillcolor=fillcolor,
|
|
|
|
| 326 |
|
| 327 |
dot.node(
|
| 328 |
rel_name,
|
| 329 |
+
rel_name,
|
| 330 |
shape=rel_shape,
|
| 331 |
style=rel_style,
|
| 332 |
fillcolor=rel_color,
|