ERD

class src.erd.ERD(filename='erd', engine='dot', image_format='png')

Bases: object

Parameters:
  • filename (str) – Name of the generated dot code and image file.

  • engine (str) – Specify the dot engine used to generate the image.

  • image_format (str) – The image extension.

gr

Graphviz object.

static _check_node_label(node_name, node_label=None)

Returns the node_name if the node_label is None. Otherwise, the node_name will be used as the label for the graphviz node.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

Returns:

The string that will be used as label.

Return type:

str

static _process_label(text)

Insert brackets around text.

Parameters:

text (str | None) – Text to be processed.

Returns:

Processed text.

Return type:

Optional[str]

static _str_key(label)

String processing for key attributes.

Parameters:

label (str) – Label to be processed.

Returns:

Processed label.

Return type:

str

static _str_weak_key(label)

String processing for weak key attributes.

Parameters:

label (str) – Label to be processed.

Returns:

Processed label.

Return type:

str

associative_entity(node_name, node_label=None)

This method declares an associative entity.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

attribute(node_name, node_label=None)

This method declares an attribute.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

derived(node_name, node_label=None)

This method declares a derived attribute.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

entity(node_name, node_label=None)

This method declares an entity.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

key(node_name, node_label=None)

This method declares a key attribute.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

multivalue(node_name, node_label=None)

This method declares a multivalued attribute.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

relation(relation_name, ent1, ent2, label_ent1=None, label_ent2=None, identifying='no')

This method declares the relationship between attributes.

Parameters:
  • relation_name (str) – Text that will appear at the node.

  • ent1 (str) – The first entity.

  • ent2 (str) – The second entity.

  • label_ent1 (str | None) – Text that will appear between the relationship diamond and the first entity.

  • label_ent2 (str | None) – Text that will appear between the relationship diamond and the second entity.

  • identifying (str) – No: single lines. Yes: double lines.

weak_entity(node_name, node_label=None)

This method declares a weak entity.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.

weak_key(node_name, node_label=None)

This method declares a weak key attribute.

Parameters:
  • node_name (str) – Name of the node.

  • node_label (str | None) – Name that will appear at the node.