Get Attributes
Last update: 16.07.2025Find out about the database schema by accessing the attributes property of the Table object.
Connect to MI
from GRANTA_MIScriptingToolkit import granta as mpy
mi = mpy.connect('http://my.server.name/mi_servicelayer', autologon=True)
Get table
Get a database, then set the unit system for the Database object.
db = mi.get_db(db_key='MI_Training')
db.unit_system = 'Metric'
db.unit_system
Previous cell output:
'Metric'
Get a table from the database.
tab = db.get_table('Training Exercise for Import')
tab
Previous cell output:
<Table name: Training Exercise for Import, subsets: {'Materials'}>
Access the attribute definitions
These are associated with the Table object through the attributes property,
which returns a dictionary of AttributeDefinition objects.
print('{:30.30} - {:^10.10} - {:^10.10} - {:^10.10}'.format('Name', 'Type', 'Unit', 'Meta?'))
print('-'*70)
for name, att in tab.attributes.items():
output = '{:30.30} - {:^10.10} - {:^10.10} - {:^10.10}'.format(name, att.type, att.unit, str(att.is_meta))
print(output)
Previous cell output:
Name - Type - Unit - Meta?
----------------------------------------------------------------------
```*Previous cell output:*
```output
Base - DISC - - False
Composition - STXT - - False
Density - POIN - kg/m^3 - False
Description - LTXT - - False
Document - FILE - - False
Electrical Properties - DISC - - False
Material - STXT - - False
More Information - HLNK - - False
Tensile Modulus - RNGE - GPa - False
Tensile Strength - RNGE - MPa - False
Transparent - LOGI - - False
Typical Use - PICT - - False
Young's Modulus - FUNC - GPa - False
Stress-strain Chart - FUNC - MPa - False
Creep Rupture - FUNC - MPa - False
Environmental Resistance - DSFN - - False
Design Allowable Data - TABL - - False
Atomic number - INPT - - False
Date of datasheet release - DTTM - - False
Wikipedia page - HLNK - - False
Environmental performances ove - TABL - - False
Characterization of this mater - TABL - - False
Yield Strength - POIN - MPa - False