Attribute definitions
Last update: 16.07.2025class PseudoAttributeDefinition
__init__(name)
Stores basic information about a pseudo-attribute.
NOTE
Supported names are:
recordTyperecordHistoryIdentityrecordColorrecordVersionNumbertableNamewritableparentShortNameparentNameparentRecordHistoryIdentityshortNamemodifiedDatecreatedDatereleasedDatelastModifiercreatorsubsetsname
- Parameters: name – str
- Returns: None
property id
Attribute identifier (this is always 0 for pseudo-attributes).
- Returns: int
property read_only
Whether the current user has the correct permissions to edit the attribute.
- Returns: bool
property unit
Unit symbol for the pseudo-attribute.
- Returns: str
property name
Name of the pseudo-attribute.
- Returns: str
property type
Data type of the pseudo-attribute (four-character string).
- Returns: str
class AttributeDefinition
Base attribute definition class.
NOTE
Do not create new instances of this class or its subclasses; it represents a pre-existing database structure.
Stores basic information about an attribute, such as data type or possible values. Contains information about the attribute itself, and cannot be used to set attribute values.
property table
Parent Table the attribute belongs to.
- Returns:
Tableobject
property id
Attribute identifier.
- Returns: int
property axis_name
Y-axis name (for functional data attributes only).
- Returns: str
property name
Attribute name.
- Returns: str
property order
Display order in MI Viewer.
- Returns: int
property is_meta
Whether the attribute is a meta-attribute or not.
- Returns: bool
property is_meta_for
Name of the parent attribute, if the attribute is a meta-attribute. Returns None if not a meta-attribute.
- Returns: str or None
property type
Attribute data type, as a four-character string. Possible attribute types are:
POIN = point,
RNGE = range,
FUNC = float functional,
INPT = integer,
LOGI = logical,
DISC = discrete,
STXT = short text,
LTXT = long text,
DTTM = date time,
HLNK = hyperlink,
PICT = picture,
FILE = file,
DSFN = discrete functional,
MAFN = maths functional (equations and logic),
TABL = tabular.
DSFN attributes are not fully supported by the MI Scripting Toolkit. Definitions can be obtained but attribute
values are exported as UNSUPPORTED DATA TYPE and contain no data.
MAFN attribute definitions cannot be obtained via the MI Scripting Toolkit.
- Returns: str
property unit
Unit symbol.
- Returns: str
property meta_attributes
Meta-attributes associated with this attribute, indexed by name.
- Returns:
Dict[str,
AttributeDefinition]
search_criterion(less_than=None, greater_than=None, contains=None, contains_any=None, contains_all=None, does_not_contain=None, exists=None, equal_to=None, between_dates=None, in_column=None)
Creates a search criterion for use with Table.search_for_records_where() or
Database.search_for_records_where().
Operator priority is the same as the order of the arguments.
- Parameters:
- less_than – float
- greater_than – float
- contains – Union[str, bool]
- contains_any – List[str]
- contains_all – List[str]
- does_not_contain – str
- exists – bool
- equal_to – Union[int, str]
- between_dates – Union[str, datetime.datetime] (Two dates in chronological order, str must be in YYYY-MM-DD format)
- in_column – str (Name of tabular column to search)
- Returns:
SearchCriterionobject
NOTE
To perform an exact search on a discrete attribute, use either the contains_any or
contains_all parameters. In the case of searching for a single discrete value, the argument
should be a list containing the search term.
property history
Revision history of the attribute, as an ObjectHistory object.
- Returns:
ObjectHistoryobject
class AttributeDefinitionDatetime
Extended AttributeDefinition class for date-time attributes.
Provides properties to view the table-wide minimum and maximum values for this attribute.
property max
Maximum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property min
Minimum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
class AttributeDefinitionDiscrete
Extended AttributeDefinition class for discrete attributes.
Provides a method to view the possible discrete values of an attribute.
property discrete_values
All possible discrete values of the attribute.
- Returns: List[str]
property is_multivalued
Whether this attribute allows multiple values to be set.
- Returns: bool
class AttributeDefinitionFile
Extended AttributeDefinition class for file attributes.
class AttributeDefinitionHyperlink
Extended AttributeDefinition class for hyperlink attributes.
class AttributeDefinitionInteger
Extended AttributeDefinition class for integer attributes.
Provides properties to view the table-wide minimum and maximum values for this attribute.
property is_unique
Whether this attribute is defined as unique.
- Returns: bool
property max
Maximum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property min
Minimum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
class AttributeDefinitionLogical
Extended AttributeDefinition class for logical attributes.
class AttributeDefinitionLongText
Extended AttributeDefinition class for long text attributes.
class AttributeDefinitionPicture
Extended AttributeDefinition class for picture attributes.
class AttributeDefinitionRange
Extended AttributeDefinition class for range attributes.
Provides access to range-specific information and methods.
property database_unit
The database unit for this attribute.
- Returns: str
property max
Maximum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property min
Minimum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property unit
Unit symbol.
- Returns: str
class AttributeDefinitionShortText
Extended AttributeDefinition class for short text attributes.
property is_unique
Whether this attribute is defined as unique.
- Returns: bool
class AttributeDefinitionTabular
Extended AttributeDefinition class for tabular data attributes.
Provides access to tabular-specific information and methods, such as columns, linking attribute and cross-table links.
property linking_attribute
Linking attribute, a short text-type attribute used to link rows in the tabular data attribute to records.
Returns None for purely local tabular data or if the user cannot access the table in Granta MI.
- Returns:
AttributeDefinitionobject or None
property linking_table
Table object which the linking attribute belongs to. Returns None for purely local tabular data
or if the user cannot access the table in Granta MI.
- Returns:
Tableobject or None
property column_types
Data type in each column.
Populated for local tabular columns. Empty string for linked columns. None for unavailable columns.
- Example:
['STXT', 'POIN', 'DISC', '', ''] - Returns: List[str]
property column_histories
The revision histories of each column, as an ordered list of ObjectHistory objects.
The object history of unavailable columns is None. See column_targets.
- Returns:
List[Optional[
ObjectHistory]]
property column_units
Unit symbols for each column.
- Returns: List[str]
property column_database_units
Database unit symbols for each column.
- Returns: List[str]
property discrete_values
All possible discrete values, for all columns with the discrete data type.
- Returns: List[List[str]]
property column_targets
Column meta-types. Possible column targets are:
Local - Contains local data
TargetAttribute - Contains data from a linked attribute
TargetRecord - Contains the records that the rows link to
TargetTabularColumn - Contains data from a linked tabular column
Unavailable - Data cannot be viewed, usually due to version control or permissions
- Returns: List[str]
property columns
Column names (headers).
- Returns: List[str]
property columns_to_process
Columns to be included when populating an AttributeTabular object. Defaults to all
columns, which will fully populate the AttributeTabular object. Columns that aren’t processed contain the
value <ignored>. Tabular attributes with <ignored> columns can be imported back into Granta MI with no
loss of data (additional conditions exist for Picture and File columns, see Warning below).
Ignoring columns that aren’t required by the script can significantly improve performance for operations with large amounts of tabular data.
NOTE
This property must be set on the AttributeDefinitionTabular object associated with the Table object before data export for the setting to have an effect.
WARNING
If the intention is to export, modify, and update tabular data, and Table.bulk_fetch() is
being used for the initial export of data, it is recommended to call Table.bulk_fetch() with
include_binary_data = True.
If Table.bulk_fetch() is called with include_binary_data = False, Picture and File columns must
not be removed from the columns_to_process list or an exception will be raised when attempting to
re-import the tabular attribute.
It is possible to call Table.bulk_fetch() with include_binary_data = False as long as all Picture
and File columns are set to be processed, but this will have a performance impact. See the
Table.bulk_fetch() documentation for more details.
- Returns: List[str]
property ignore_linked_records
Whether to ignore linked records when creating Record objects. Defaults to False.
Even when set to True, linking values are still available if populated.
Ignoring linked records if they aren’t required can significantly improve performance for operations with large amounts of tabular data.
NOTE
This property must be set on the AttributeDefinitionTabular object associated with the Table object before data export for the setting to have an effect.
- Returns: bool
class AttributeDefinitionMultiValue
Extended AttributeDefinition class for functional and point data attributes.
Provides access to functional data parameters.
property parameters
Parameters associated with the attribute, indexed by name.
- Returns:
Dict[str,
AttributeParameter]
property database_unit
The database unit for this attribute.
- Returns: str
class AttributeDefinitionFloatFunctional
Extended AttributeDefinitionMultiValue class for float functional attributes.
property database_unit
The database unit for this attribute.
- Returns: str
property parameters
Parameters associated with the attribute, indexed by name.
- Returns:
Dict[str,
AttributeParameter]
class AttributeDefinitionPoint
Extended AttributeDefinitionMultiValue class for point attributes.
Provides access to point-specific information and methods.
property is_multivalued
Whether this attribute allows multiple values to be set.
- Returns: bool
property database_unit
The database unit for this attribute.
- Returns: str
property max
Maximum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property min
Minimum value of the data attribute. Affected by user read permissions.
- Returns: Optional[Union[float, int, datetime.datetime]]
property parameters
Parameters associated with the attribute, indexed by name.
- Returns:
Dict[str,
AttributeParameter]
property unit
Unit symbol.
- Returns: str
class AttributeDefinitionUnsupported
Extended AttributeDefinition class for unsupported attribute types (discrete functional).
Provides access to the limited information available for unsupported attribute types (name, type and unit, if present).
class AttributeDefinitionDiscreteFunctional
Extended AttributeDefinitionUnsupported class for discrete functional attributes.
Provides access to the limited information available (name, type and unit, if present).”