class PseudoAttributeDefinition
Stores basic information about a pseudo-attribute.- Parameters: name (str) – Name of the pseudo-attribute.
Notes
Supported names are:-
recordType -
recordHistoryIdentity -
recordColor -
recordVersionNumber -
tableName -
writable -
parentShortName -
parentName -
parentRecordHistoryIdentity -
shortName -
modifiedDate -
createdDate -
releasedDate -
lastModifier -
creator -
subsets -
name - Raises: ValueError – If the name is not a recognized pseudo-attribute name.
property id : int
Attribute identifier. Always 0 for pseudo-attributes.- Return type: int
property name : str
Name of the pseudo-attribute.- Return type: str
property read_only : bool
Whether the current user has the correct permissions to edit the attribute.- Return type: bool
property type : str
Data type of the pseudo-attribute (four-character string).- Return type: str
class AttributeDefinition
Base attribute definition class. Stores basic information about an attribute, such as data type or possible values. Contains information about the attribute itself, not the data. Cannot be used to set attribute values.Notes
Do not create instances of this class, it represents an abstract database structure.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 withTable.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 , optional) – Search for values less than this.
- greater_than (float , optional) – Search for values greater than this.
- contains (str or bool , optional) – Search for values containing this.
- contains_any (list [str ] , optional) – Search for values containing any of these.
- contains_all (list [str ] , optional) – Search for values containing all of these.
- does_not_contain (str , optional) – Search for values not containing this.
- exists (bool , optional) – Search for existence of attribute values.
- equal_to (int or str , optional) – Search for values equal to this.
- between_dates (tuple [datetime.date , datetime.date ] , optional) – Two dates in chronological order to search between.
- in_column (str , optional) – Name of tabular column to search.
- Return type:
SearchCriterionorNone - Raises:
- AssertionError – If the criterion type is incompatible with the attribute type.
- AssertionError – If required parameters are missing.
Notes
To perform an exact search on a discrete attribute, use either thecontains_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 : ObjectHistory
Revision history of the attribute.- Return type:
ObjectHistory
property id : int
Attribute identifier.- Return type: int
property is_meta : bool
Whether the attribute is a meta-attribute or not.- Return type: bool
property is_meta_for : str | None
Parent attribute name.- Returns:
Name of the parent attribute, if the attribute is a meta-attribute. Returns
Noneif not a meta-attribute. - Return type:
str or
None
property meta_attributes : Dict[str, AttributeDefinition]
Meta-attributes associated with this attribute, indexed by name.- Return type:
dict[str,
AttributeDefinition]
property name : str
Attribute name.- Return type: str
property order : int
Display order in MI Viewer.- Return type: int
property table : Table
ParentTable the attribute belongs to.
- Return type:
Table
property type : str
Attribute data type, as a four-character string.- Return type: str
Notes
- Numeric attributes:
POIN(point),RNGE(range),INPT(integer). - Text attributes:
STXT(short text),LTXT(long text),DISC(discrete). - Functional attributes:
FUNC(float functional). - Media attributes:
HLNK(hyperlink),PICT(picture),FILE(file). - Other attributes:
LOGI(logical),DTTM(date time),TABL(tabular).
DSFN (discrete functional) 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 (maths functional) attribute definitions cannot be obtained via the MI Scripting Toolkit.
class AttributeDefinitionDate
ExtendedAttributeDefinition class for date attributes.
Provides properties to view the table-wide minimum and maximum values for this attribute.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property max : date | None
Maximum value of the data attribute. Affected by user read permissions.- Return type:
datetime.date or
None
property min : date | None
Minimum value of the data attribute. Affected by user read permissions.- Return type:
datetime.date or
None
class AttributeDefinitionDiscrete
ExtendedAttributeDefinition class for discrete attributes.
Provides a method to view the possible discrete values of an attribute.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property discrete_values : List[str]
All possible discrete values of the attribute, in the order defined by the associated discrete type.property is_multivalued : bool
Whether this attribute allows multiple values to be set.- Return type: bool
property is_ordered : bool
Whether the discrete type associated with the discrete attribute is ordered.- Return type: bool
class AttributeDefinitionFile
ExtendedAttributeDefinition class for file attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionHyperlink
ExtendedAttributeDefinition class for hyperlink attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionInteger
ExtendedAttributeDefinition class for integer attributes.
Provides properties to view the table-wide minimum and maximum values for this attribute.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property is_unique : bool
Whether this attribute is defined as unique.- Return type: bool
property max : int | None
Maximum value of the data attribute. Affected by user read permissions.- Return type:
int or
None
property min : int | None
Minimum value of the data attribute. Affected by user read permissions.- Return type:
int or
None
class AttributeDefinitionLogical
ExtendedAttributeDefinition class for logical attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionLongText
ExtendedAttributeDefinition class for long text attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionPicture
ExtendedAttributeDefinition class for picture attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionRange
ExtendedAttributeDefinition class for range attributes.
Provides access to range-specific information and methods.
property database_unit : str | None
The database unit for this attribute.- Return type: str or None
property default_unit : str | None
Attribute database unit in the active unit system. The unit used by MI Viewer or MI Explore to display this attribute in the active unit system. This property is only affected by the unit system choice, and is not affected byTable.set_display_unit().
property max : float | None
Maximum value of the data attribute. Affected by user read permissions.- Return type:
float or
None
property min : float | None
Minimum value of the data attribute. Affected by user read permissions.- Return type:
float or
None
property unit : str | None
Unit symbol.- Return type: str or None
class AttributeDefinitionShortText
ExtendedAttributeDefinition class for short text attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property is_unique : bool
Whether this attribute is defined as unique.- Return type: bool
class AttributeDefinitionTabular
ExtendedAttributeDefinition class for tabular data attributes.
Provides access to tabular-specific information and methods, such as columns, linking attribute and
cross-table links.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property column_database_units : List[str | None]
Database unit symbols for each column.property column_histories : List[ObjectHistory | None]
The revision histories of each column.- Returns:
List of equal length to the number of columns. Each item is either an object history, or
Nonefor unavailable columns. Usecolumn_targetsto identify unavailable columns. - Return type:
list[
ObjectHistoryorNone]
property column_targets : List[str]
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. - Return type: list[str]
property column_types : List[str | None]
Data type for each column.- Returns:
List of equal length to the number of columns. Each item is one of a type codes for local tabular columns,
an empty string for linked columns, or
Nonefor unavailable columns. Usecolumn_targetsto identify unavailable columns. - Return type:
list[str or
None]
Examples
SEE ALSO
AttributeDefinition.type
: List of type codes.
property column_units : List[str | None]
Unit symbols for each column.property columns : List[str]
Column names (headers).property columns_to_process : List[str]
Columns to be included when populating an AttributeTabular object. Defaults to all columns, which will fully populate the AttributeTabular object. The content of unprocessed columns depends on the column type:- Ignored linked columns contain the value
<Ignored>in all cells. - Ignored local tabular columns contain instances of
IgnoredLocalTabularCell. These objects contain no accessible data, and they cannot be modified.
Notes
This property must be set on the AttributeDefinitionTabular object associated with the Table object before data export for the setting to have an effect.property discrete_values : List[List[str]]
All possible discrete values, for all columns with the discrete data type.property ignore_linked_records : bool
Whether to ignore linked records when creating Record objects. Defaults toFalse. 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.
- Return type: bool
Notes
This property must be set on the AttributeDefinitionTabular object associated with the Table object before data export for the setting to have an effect.property linking_attribute : None | AttributeDefinition
Short text-type attribute used to link rows in the tabular data attribute to records.- Returns:
The attribute definition of the linking attribute. Returns
Nonefor purely local tabular data or if the user annot access the table in Granta MI. - Return type:
AttributeDefinitionorNone
property linking_table : None | Table
Table object which the linking attribute belongs to.
- Returns:
The table object that the tabular attribute is linked to. Returns
Nonefor purely local tabular data or if the user cannot access the table in Granta MI. - Return type:
TableorNone
class AttributeDefinitionMultiValue
ExtendedAttributeDefinition class for functional and point data attributes.
Provides access to functional data parameters.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property parameters : Dict[str, AttributeParameter]
Parameters associated with the attribute, indexed by name.- Return type:
dict[str,
AttributeParameter]
class AttributeDefinitionFloatFunctional
ExtendedAttributeDefinitionMultiValue class for float functional attributes.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property axis_name : str
Y-axis label.- Return type: str
property database_unit : str | None
The database unit for this attribute.- Return type: str or None
property parameters : Dict[str, AttributeParameter]
Parameters associated with the attribute, indexed by name.- Return type:
dict[str,
AttributeParameter]
property unit : str | None
Unit symbol.- Return type: str or None
class AttributeDefinitionPoint
ExtendedAttributeDefinitionMultiValue class for point attributes.
Provides access to point-specific information and methods.
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
property database_unit : str | None
The database unit for this attribute.- Return type: str or None
property default_unit : str | None
Attribute database unit in the active unit system. The unit used by MI Viewer or MI Explore to display this attribute in the active unit system. This property is only affected by the unit system choice, and is not affected byTable.set_display_unit().
property is_multivalued : bool
Whether this attribute allows multiple values to be set.- Return type: bool
property max : float | None
Maximum value of the data attribute. Affected by user read permissions.- Return type:
float or
None
property min : float | None
Minimum value of the data attribute. Affected by user read permissions.- Return type:
float or
None
property parameters : Dict[str, AttributeParameter]
Parameters associated with the attribute, indexed by name.- Return type:
dict[str,
AttributeParameter]
property unit : str | None
Unit symbol.- Return type: str or None
class AttributeDefinitionUnsupported
ExtendedAttributeDefinition class for unsupported attribute types (discrete functional).
Provides access to the limited information available for unsupported attribute types (name, type and unit, if
present).
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.
class AttributeDefinitionDiscreteFunctional
ExtendedAttributeDefinitionUnsupported class for discrete functional attributes.
Provides access to the limited information available (name, type and unit, if present).
Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTable.attributes to access instances of this class.