Database-Specific Configuration Options¶
The BoM Analytics package will work with an off-the-shelf Granta MI Restricted Substances database. However, there are some situations in which additional run-time configuration changes are required:
If the database key or table names have been modified from their default values, these must be set on the
If the number of linked records is very large, the batch sizes should be changed for each query (see Batching Requests for more details)
Specifying a Custom Database Key or Table Name¶
The default database key,
MI_Restricted_Substances, is used if no database key is specified. To specify an alternative, use the
Connection.set_database_details() method. This database key will be used for all queries made with this
from ansys.grantami.bomanalytics import Connection server_url = "http://my_grantami_server/mi_servicelayer" cxn = Connection(server_url).with_credentials("user_name", "password").connect() cxn.set_database_details(database_key="ACME_SUBSTANCES_DATABASE") cxn
<BomServicesClient: url="http://my_grantami_server/mi_servicelayer", dbkey="ACME_SUBSTANCES_DATABASE">
It is also possible to specify alternative names for the relevant Restricted Substances tables, if they have been modified from the defaults. These are provided to the
.set_database_details() method in the same way.
cxn.set_database_details(in_house_materials_table_name="ACME Materials") cxn
<BomServicesClient: url="http://my_grantami_server/mi_servicelayer", dbkey="MI_Restricted_Substances">
The queries that can be performed with this package are batched if they exceed a certain size. This is achieved by splitting the list of parts, materials, etc. into smaller lists to reduce the overall time taken to perform the query. Default batch sizes have been chosen based on typical tabular attribute sizes, but these may need to be changed in some situations (see the relevant page in the API documentation for examples).
The batch size is included in the query
__repr__. The cell below shows a
SpecificationComplianceQuery object with the default batch size.
from ansys.grantami.bomanalytics import queries spec_query = queries.SpecificationComplianceQuery() spec_query
<SpecificationComplianceQuery: 0 specifications, batch size = 10, 0 indicators>
You can manually set the batch size by doing the following:
spec_query = spec_query.with_batch_size(5) spec_query
<SpecificationComplianceQuery: 0 specifications, batch size = 5, 0 indicators>