What’s new in Version 4.1
Last update: 16.07.2025Key features introduced or improved in MI Scripting Toolkit 4.1.
Highlights
Improvements to parameter classes
DatabaseParameter, AttributeParameter, and ExporterParameter classes have been added in
this release. These classes are sub-classes of the base ParameterDefinition class, and represent parameters
at different levels of the Granta MI data hierarchy:
| Class | Description | Returned by |
|---|---|---|
DatabaseParameter |
Represents a parameter defined at the database level. These parameters are defined generically, and are not assigned to an attribute. |
Database.parameters |
AttributeParameter |
Represents a database parameter assigned to a particular attribute. This class inherits all properties and methods from the DatabaseParameter class, and addsAttributeParameter.order and AttributeParameter.parent_attribute. |
AttributeDefinitionFloatFunctional.parametersAttributeDefinitionPoint.parameters |
ExporterParameter |
Represents a parameter specified as an input for an FEA Export operation. This class inherits all properties and methods from the DatabaseParameter class, and addsExporterParameter.value_for_exporters and ExporterParameter.clear_value_for_exporters(). |
Exporter.get_parameters_required_for_export() |
These improvements make it easier to understand which type of parameter is returned by properties and methods, and makes it clearer which functionality is provided by those returned objects.
Enhancements and bug fixes
The following enhancements and bug fixes have been made to parameter classes:
ParameterDefinition.axis_scale_typeno longer incorrectly returnsLogfor discrete parameters. It now returnsNone.AttributeParameter.parent_attributeno longer returns an empty string. It now returns anAttributeDefinitionMultiValueobject.- Setting a parameter unit using the
ParameterDefinition.unitproperty now raises aValueErrorif the specified unit either could not be found in the database or is not dimensionally equivalent with the database unit.
Backwards incompatible API changes
The following backwards-incompatible changes have been made to parameter classes:
ParameterDefinition.typehas been deprecated. Use theParameterDefinition.data_typeandParameterDefinition.restrictedparameters instead.- The attribute
parent_recordof the classParameterDefinitionhas been removed as the information is not currently available in Scripting Toolkit. Attempting to access this attribute will raise anAttributeError. - The
orderandparent_attributeproperties were previously implemented on theParameterDefinitionclass, and so were accessible for all parameter objects. However, these properties only have meaning when requested for an attribute parameter and had undefined behavior for database parameters. These properties have been moved to theAttributeParameterclass. Attempting to access these properties from aDatabaseParameterobject will raise anAttributeError. - It is no longer permitted to provide database or attribute parameters to
Exporter.run_exporter(). The results of theExporter.get_parameters_required_for_export()method must be used to specify parameter values for export. If you do not use the results of theExporter.get_parameters_required_for_export()method aTypeErrorwill be raised.
Unit systems and absolute temperatures
Summary
Passing certain combinations of absolute_temperature and unit_system values to the
Database.set_unit_system(), Database.get_table(), and Database.get_table_by_guid() methods
resulted in database and table objects in unexpected states.
Fix applied:
- The default absolute temperature scale on databases is now
False.- The
absolute_temperatureandunit_systemvalues are now always respected when passed to these methods, and will override any previously set values on theDatabaseobject.
Recommended usage:
- Remove uses of
Database.set_unit_system(), and of theabsolute_temperatureandunit_systemarguments ofDatabase.get_table()andDatabase.get_table_by_guid().- Use
Database.unit_systemandDatabase.absolute_temperaturesto explicitly set the unit system and the absolute temperature scale on theDatabase.
Detailed description of changes
This section describes the previous incorrect behavior and usages that are subject to behavior changes in version 4.1.
- If the
unit_systemandabsolute_temperaturearguments were never used, the default absolute temperature wasTrue. It now defaults toFalse.- If only the
absolute_temperatureargument was provided, it was ignored and the absolute temperature scale was not updated on the database.- If the
unit_systemargument was provided, it only had an effect if the provided value was not theDATABASE_UNIT_SYSTEMand if the provided value was different from the previously active unit system:
Unit system change absolute_temperatureprovidedabsolute_temperaturenot providedTrue absolute_temperaturerespectedabsolute_temperatureset toFalseFalse absolute_temperatureignoredabsolute_temperatureunchanged
In version 4.1, the behavior of these methods and arguments has been fixed. In order to clarify the expected behavior and to avoid unwanted interaction between independent arguments in the future and unexpected mutation of parent objects, some functionality has been deprecated:
- The
unit_system, andabsolute_temperaturesparameters for the methodsDatabase.get_table()andDatabase.get_table_by_guid()have been deprecated.- The method
Database.set_unit_system()has been deprecated.
To work with specific unit systems or absolute temperature scale, the recommended approach is to use setters on the
database properties Database.unit_system and Database.absolute_temperatures. For example:
database.unit_system = "UK Imperial"
database.absolute_temperatures = True
table = database.get_table(table_name)
In all cases, it is recommended to test scripts and applications being updated to the 4.1 version of the MI Scripting Toolkit, to ensure the expected units are applied.
Enhancements
The behavior of unit systems and absolute temperature units has been standardized in this release.
- The
Database.absolute_temperaturesproperty is now respected by all tables, parameters, and attributes. This allows the setting to be consistently applied throughout a database. - Setting the unit on a
DatabaseParameteror anAttributeParameteris respected by the.valuesand.default_valueproperties. This fixes an issue where the unit would not be respected when displaying values. - In some cases the default
Database.absolute_temperatureswould be set toTrue. It is now set toFalsein all situations. - The column headings in
FunctionalSeries.valueandFunctionalGrid.value, and theFunctionalSeries.parametersandFunctionalGrid.parametersproperties correctly respect theunit_systemandabsolute_temperaturesvalues specified on theDatabaseobject. This fixes an issue where in some cases the unit would be reported incorrectly. - Using
Table.set_display_unit()to set an attribute to the same current display unit no longer raises aValueError.
Backwards incompatible API changes
The features listed in this section provide potentially confusing behavior. Code that uses these features should be modified according to the recommendations below. The features will be removed in a future release.
- The
unit_system, andabsolute_temperaturesparameters for the methodsDatabase.get_table()andDatabase.get_table_by_guid()have been deprecated. To specify the unit system or whether absolute temperatures should be used, use the propertiesDatabase.unit_systemandDatabase.absolute_temperatures. - The method
Database.set_unit_system()has been deprecated. To set the unit system on the database useDatabase.unit_systemand to set the value of absolute_temperatures useDatabase.absolute_temperatures.
Streamlined API enhancements and bug fixes
Enhancements
-
Added
Record.copy_to()to copy records. -
Added
Table.default_layout, providing the name of the default layout for a table. -
Improved documentation of
Database.search_for_records_where()andTable.search_for_records_where(). -
Attribute min/max information is no longer fetched by default when retrieving attributes for a table.
-
AttributeDiscretenow validates values before trying to write to the database.- If a value is not permitted according to the discrete values defined in the database schema, a
ValueErroris raised. - If the value is not a string or a list of strings then a
TypeErroris raised.
Additionally, passing a list of values to a single-valued discrete is now deprecated and will be removed in a future release.
- If a value is not permitted according to the discrete values defined in the database schema, a
-
Fetching attribute definitions from a table now returns distinct classes for each type of attribute, see Attribute Definitions for more information.
-
LinkGroupDetailsnow includes two additional properties,database_fromanddatabase_to. These provide access to the database key of the source database and target database respectively. -
The
Exporterdocumentation has been extended to describe all public properties of the class.
Bug fixes
Table.get_records_from_path()now raises aKeyErrorwhenever an invalidtree_pathparameter is provided.- Extrema information
AttributeDefinitionPoint.min,AttributeDefinitionPoint.max,AttributeDefinitionRange.min,AttributeDefinitionRange.max,AttributeDefinitionInteger.min,AttributeDefinitionInteger.max,AttributeDefinitionDatetime.min, andAttributeDefinitionDatetime.maxnow returnNonein the following cases:- When the attribute is either empty or not applicable for all records in the table.
- When the
min_max_typeis set to"None".
Table.default_subsetno longer returns an empty string if the table does not define a default subset. It now returnsNone.Database.get_table()no longer throws an unexpected error when handling a table with no default subset.- The property
AttributeDefinitionTabular.column_historiesno longer raises an exception for columns that are unavailable (due to access control or a missing database used in cross database tabular links).
Examples
- Added new Data validation notebook that demonstrates how to use Scripting Toolkit to validate data in a Granta MI database.
Foundation API enhancements and bug fixes
FloatFunctionalGriddedDataType.functionalDataParameterSettingsandFloatFunctionalSeriesDataType.functionalDataParameterSettingsnow return correctly parsed values. Additionally, importing data no longer sets datum default values unless explicitly requested.
Backwards incompatible API changes
Streamlined API
- The
log_to_file_in_local_app_data()function has been deprecated. To log messages to a file, use the Python logging module. The Foundation Layer logger can be obtained with the functionget_foundation_logger(). - The methods
Database.get_all_link_details_where()andDatabase.get_link_detail(), and the propertyDatabase.link_detailshave been deprecated. To obtain record link group information use the propertyDatabase.record_link_groups. - The
subsetsparameter for the methodsDatabase.get_table()andDatabase.get_table_by_guid()has been deprecated. To specify one or more subsets for the table, use theTable.subsetsproperty of the returned table object. - Passing a list of values to a
AttributeDiscretewhereAttributeDiscrete.is_multivaluedis False is now deprecated, provide a single string instead.
Known issues
-
If an attribute is exported with the
Table.bulk_fetchmethod withinclude_binary_data=False, subsequent values returned by theAttributePicture.mime_file_typeproperty will always returnimage/png, regardless of the actual image format. The header returned when accessing the URL is unaffected and should be used instead. -
In version-controlled tables,
DataRevisionHistoryobjects have an ambiguous meaning. Thehistory.last_modified_datefor the following attribute types is updated when the release state of the parent record is modified:- Date
- Hyperlink
- Integer
- Logical
- Range
- Short text
The
history.last_modified_datefor the following attribute types is not updated when the release state of the parent record is modified:- Discrete
- File
- Functional
- Long text
- Picture
- Point
- Tabular