Skip to main content

Granta MI Scripting Toolkit 4.2

Bulk operators

Last update: 16.07.2025

class AttributeFetcher

Bulk exporter for record data. Fetches data values for all named AttributeDefinition and PseudoAttributeDefinition objects from the specified Record objects and Table.

Set attributes to None to export all record data.

A class method executes the data export, allowing the AttributeFetcher to be edited post-creation.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Table.bulk_fetch() to fetch attribute values in bulk.

__init__(table, batch_size=100, attributes=None, records=None, max_parallel_threads=6, include_binary_data=False)

  • Parameters:
    • tableTable object
    • batch_size – int (default value of 100)
    • attributes – Union[List[Union[AttributeDefinition, PseudoAttributeDefinition]], List[str]]
    • records – List[Record]
    • max_parallel_threads – int (default value of 6)
    • include_binary_data – bool (default value of False)
  • Returns: None

property records

List of records to be fetched (exported).

property attribute_list

List of attributes for which data will be fetched (exported).

fetch_attribute_data(parallelise=False)

Fetch the attribute data for the provided records and attributes, and populate the corresponding AttributeValue objects for each record.

  • Parameters: parallelise – bool
  • Returns: None

class AssociatedRecordFetcher

Bulk fetcher for associated records. Fetches all Record objects via association chains from the specified Record objects in the target Table. Provides means to choose the direction that association chains are followed, and to specify a list of tabular attributes which are chained together.

This operation performs no subset filtering.

A class method executes the fetch, allowing the AssociatedRecordFetcher to be edited post-creation.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Table.bulk_fetch_associated_records() to fetch associated records in bulk.

  • Parameters:
    • tableTable
    • records – List[Record]
    • target_tableTable
    • link_direction – str (Both, Forward, Reverse)
    • attribute_path – List[AttributeDefinition]
    • batch_size – int (default value of 100)
  • Returns: None

fetch_associated_records(parallelise=False, max_parallel_threads=6)

Fetch the associated records in the specified Table from the specified Record objects. Return a list of dictionaries with source_record and associated_records fields for each provided Record.

This operation performs no subset filtering.

  • Parameters:
    • parallelisebool
    • max_parallel_threadsint (default 6)
  • Returns: List[Dict[str, Union[Record, List[Record]]]]

class LinkFetcher

Bulk record link fetcher (exporter). Fetches and populates record link groups for the specified Record objects in the specified Table. Set link_groups to None to fetch all record link groups.

Set filter_subsets to True to return records that are in the default subsets of the target table. Set it to False to search with no filtering by subset.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Table.bulk_link_fetch() to fetch links in bulk.

  • Parameters:
    • tableTable object
    • batch_size – int (default value of 100)
    • records – List[Record]
    • link_groups – List[str]
    • filter_subsets – bool (default value of True)
  • Returns: None

List of link groups to export.

  • Returns: List[str]

property records

List of records to fetch link groups for.

fetch_linked_records(parallelise=False, max_parallel_threads=6)

Perform the bulk fetch (export). Batches Service Layer calls into efficient blocks, then populates Record object pseudo-attributes.

  • Parameters:
    • parallelise – bool
    • max_parallel_threads – int (default value of 6)
  • Returns: None

class ReleaseStateFetcher

Allows record release states to be fetched from the server in bulk.

The list of Record objects, batch size, and number of threads in parallel can be edited post-creation.

A class method fetches the release states and populates the relevant Record properties.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Session.bulk_fetch_release_states() to fetch release states in bulk.

__init__(session, records, batch_size=100, max_parallel_threads=6)

  • Parameters:
    • batch_size – int (default value of 100)
    • records – List[Record]
    • max_parallel_threads – int (default value of 6)
  • Returns: None

property records

List of Record objects to be processed.

fetch_release_states(parallelise=False)

Fetches the release states of the specified Record objects from the server, and populates their relevant properties.

  • Parameters: parallelise – bool (splits operation into multiple threads if set to True)
  • Returns: None

class BulkRecordDeleterWithdrawer

Allows for bulk deletion or withdrawal or records from the server. Records are withdrawn from version-controlled tables, otherwise they are deleted.

The deletion/withdrawal is performed by a method on the class; as such, the list of Record objects for deletion, batch size, and number of threads in parallel can be edited post-creation.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Session.bulk_delete_or_withdraw_records() to delete and withdraw records in bulk.

__init__(session, records, batch_size=100, max_parallel_threads=6, withdrawal_notes=None)

  • Parameters:
    • sessionSession object
    • batch_size – int (default value of 100)
    • records – List[Record]
    • max_parallel_threads – int (default value of 6)
    • withdrawal_notes – Optional[str]
  • Returns: None

property records

List of records to be deleted or withdrawn.

delete_or_withdraw(parallelise=False)

Performs the deletion (or withdrawal, if the records are in a version-controlled table).

  • Parameters: parallelise – bool (splits operation into multiple threads if True)
  • Returns: None

class DataRevisionHistoryFetcher

Bulk exporter for data revision history.

Fetches the data revision history for all attributes of the provided records and populates the Record.data_revision_history property.

See AttributeFetcher to export attribute data.

Deprecated

Deprecated since version 4.2: This class will be made private in a future release. Use Table.bulk_fetch_data_revision_history() to fetch data revision history in bulk.

__init__(_mi, records, batch_size=100, max_parallel_threads=6)

  • Parameters:
    • _miSession object
    • records – List[Record]
    • batch_size – int (default value of 100)
    • max_parallel_threads – int (default value of 6)
  • Returns: None

fetch_data_revision_history(parallelise=False)

Fetches the data revision history for all attributes of the provided records and populates the Record.data_revision_history property.

  • Parameters: parallelise – bool

Connect with Ansys