Using external records in analysis#
Added in version 2.4.
Introduction#
MI Restricted Substances and Sustainability Reports 2026 R1 introduces the ability to perform analysis on records stored in separate databases to the Restricted Substances and Sustainability database. These records are referred to below as ‘external records’, and the databases they are stored in are referred to as ‘external databases’.
Separating data across databases in this way can simplify data management by making it easier to share responsibility and ownership for different datasets across functional groups. Additionally, it is easier to adopt the Restricted Substances and Sustainability solution if existing data can be easily linked to representative data supplied with the Restricted Substances and Sustainability database.
When a BoM Analytics query is submitted that includes external records, Granta MI first identifies equivalent Restricted Substances and Sustainability records by following cross-database links between the Restricted Substances and Sustainability records and the external records. The results include both the Restricted Substances and Sustainability records and the external records, providing clear traceability for how the results were determined.
This page describes the pre-requisites for performing analysis based on external records, and provides code examples for common use cases.
Pre-requisites#
The following conditions must be met to use this feature:
The version of this package must be version 2.4 or later.
The Granta MI server is running MI Restricted Substances and Sustainability Reports 2026 R1 or later.
The records used for analysis are linked to equivalent records in the main Restricted Substances and Sustainability database. See the Granta MI Restricted Substances and Sustainability Install and Configuration, on the Ansys Help Center for more details.
Record-based queries#
For record-based queries, the database_key argument should be used when referring to external records. For example,
a material impacted substances analysis can be performed on external material records in the
MI_Mechanical_Design_Data database with the following query:
query = (
MaterialImpactedSubstancesQuery()
.with_material_ids(
material_ids=["AB-01", "BC-02", "CD-03"],
external_database_key="MI_Mechanical_Design_Data",
)
.with_legislation_ids("SINList", "CCC")
)
If the Pre-requisites are met, the results include
MaterialWithImpactedSubstancesResult objects with the following properties set:
The
record_guidproperty is set to the record GUID of the linked material record in the Restricted Substances and Sustainability database.The
database_keyproperty isNone.The
equivalent_referencesproperty is a list containing a singleMaterialReferenceobject.
The ‘equivalent’ MaterialReference object would have the following properties set:
The
material_idproperty is would be set to the appropriate material ID, for example “AB-01” for the first material record in the example.The
database_keyproperty isMI_Mechanical_Design_Data.The
equivalent_referencesproperty isNone.
BoM-based queries#
For BoM-based queries, the external database key should be used in the record or attribute reference, typically when
using the RecordReferenceBuilder or AttributeReferenceBuilder classes. For example, sustainability
analysis can be performed on a BoM which contains the following material reference:
<MIMaterialReference>
<dbKey>MI_Mechanical_Design_Data</dbKey>
<recordGUID>2086f56a-4f4d-4850-9891-3d6ad155d1f9</recordGUID>
</MIMaterialReference>
Assuming the Pre-requisites are met, the results include a
corresponding MaterialWithSustainabilityResult object with the following properties set:
The
record_guidproperty is set to the record GUID of the linked material record in the Restricted Substances and Sustainability database.The
database_keyproperty isNone.The
equivalent_referencesproperty is a list containing a singleMaterialReferenceobject.
The ‘equivalent’ MaterialReference object would have the following properties set:
The
record_guidproperty is2086f56a-4f4d-4850-9891-3d6ad155d1f9.The
database_keyproperty isMI_Mechanical_Design_Data.The
equivalent_referencesproperty isNone.