Skip to main content
`Ctrl`+`K`

# aequilibrae.project.FieldEditor

class aequilibrae.project.FieldEditor(project, table_name: str)

  Allows user to edit the project data tables

  The field editor is used for two different purposes:

  - Managing data tables (adding and removing fields)

  - Editing the tables’ metadata (description of each field)

  This is a general class used to manage all project’s data tables accessible to the user and but it should be accessed directly from within the module corresponding to the data table one wants to edit. Example:

      >>> project = create_example(project_path)

      # To edit the fields of the link_types table
      >>> lt_fields = project.network.link_types.fields

      # To edit the fields of the modes table
      >>> m_fields = project.network.modes.fields

  Field descriptions are kept in the table attributes_documentation

  __init__(project, table_name: str) → None

  Methods

  `__init__`(project, table_name) |
  `add`(field_name, description[, data_type]) | Adds new field to the data table
  `all_fields`() | Returns the list of fields available in the database
  `remove`(field_name) |
  `save`() | Saves any field descriptions which my have been changed to the database

  add(field_name: str, description: str, data_type='NUMERIC') → None

    Adds new field to the data table

    Arguments:

      field_name (`str`): Field to be added to the table. Must be a valid SQLite field name

      description (`str`): Description of the field to be inserted in the metadata

      data_type (`str`, Optional): Valid SQLite Data type. Default: “NUMERIC”

  all_fields() → List[str]

    Returns the list of fields available in the database

  remove(field_name: str) → None
  save() → None

    Saves any field descriptions which my have been changed to the database