Operations
Operations: class
Operations are the building blocks of a revision file. They represent a singular API call that does a specific action to change the Benchling model. They are generated by the liminal autogenerate
command in the upgrade/downgrade functions of a revision file and can also be created manually. Operations are used to create, update, and archive entity schemas, dropdowns, and entity schema fields (a full list of operations can be found below). Operations have a couple of common functionalities:
# Defines the operation for archiving the 'dough' field on the 'pizza' entity schema
example_operation = ArchiveEntitySchemaField('pizza', 'dough')
# Executes the operation. This will run an action using the Benchling API to execute a change. In this case, it will archive the 'dough' field on the 'pizza' entity schema.
example_operation.execute()
# Returns a description of what the operation will do.
# Ex: 'pizza: Archiving entity schema field 'dough'.'
example_operation.describe_operation()
# Returns a description of the current state of the operation.
# Ex: 'pizza: Entity schema field 'dough' is defined in Benchling but not in code.'
example_operation.describe()
# Validates the operation. Note: Not all operations have a validate() method.
example_operation.validate()
Dropdown Operations
Operation Class |
Description |
CreateDropdown |
Creates a new dropdown with specified options. |
ArchiveDropdown |
Archives an existing dropdown. |
UnarchiveDropdown |
Unarchives an archived dropdown. |
UpdateDropdownName |
Updates the name of an existing dropdown. |
CreateDropdownOption |
Creates a new option in an existing dropdown. |
ArchiveDropdownOption |
Archives an existing option in a dropdown. |
UpdateDropdownOption |
Updates the name of an existing option in a dropdown. |
ReorderDropdownOptions |
Reorders the options in an existing dropdown. |
Entity Schema Operations
Operation Class |
Description |
CreateEntitySchema |
Creates a new entity schema with specified fields. |
UpdateEntitySchema |
Updates the properties of an existing entity schema. |
ArchiveEntitySchema |
Archives an existing entity schema. |
UnarchiveEntitySchema |
Unarchives an archived entity schema. |
UpdateEntitySchemaName |
Updates the warehouse name of an existing entity schema. |
CreateEntitySchemaField |
Creates a new field in an existing entity schema. |
UpdateEntitySchemaField |
Updates the properties of an existing field in an entity schema. |
ArchiveEntitySchemaField |
Archives an existing field in an entity schema. |
UnarchiveEntitySchemaField |
Unarchives an archived field in an entity schema. |
UpdateEntitySchemaFieldName |
Updates the name of an existing field in an entity schema. |
ReorderEntitySchemaFields |
Reorders the fields in an existing entity schema. |