Today I was asked if it's possible to view the permitted values for a discrete attribute without exporting any data. The answer is yes! Here's a code sample that does this:
from GRANTA_MIScriptingToolkit import granta as mpy
mi = mpy.Session("localhost", autologon=True)
db = mi.get_db(db_key="MI_Restricted_Substances")
table = db.get_table("MaterialUniverse")
attribute = table.attributes["Form"]
print(f"Allowed values for attribute '{attribute.name}':")
print('\n\t'.join(attribute.discrete_values))
The line table.attributes["Form"] access the Table.attributes dictionary, which contains AttributeDefinition objects for each attribute defined in the table.
The code attribute.discrete_values then access the AttributeDefinitionDiscrete.discrete_values property, which is a list of the allowed discrete values for that attribute.