The GRT, or Generic RunTime, is the internal system used by Workbench to hold model document data. It is also the mechanism by which Workbench can interact with Modules and Plugins. Workbench model data, such as diagrams, schemata, and tables, is stored in a hierarchy of objects that can be accessed by any plugin. The information is represented using standard data types: integers, doubles, strings, dicts, lists, and objects.
The GRT can be accessed using external scripting languages such as Lua and Python. Awareness is required of how the GRT data types map into the scripting language. In Python, for example, the GRT integer, double, and string data types are seen as corresponding Python data types. Lists and dicts are kept in their internal representation, but can generally be treated as Python lists and dicts, and accessed in the usual way. Objects contain data fields and methods, but the GRT recognizes only objects from a pre-registered class hierarchy.
It is possible to fully examine the classes contained within the
GRT using the Workbench Scripting Shell. Dots in class names are changed to
underscores in their Python counterparts. For example,
db_mysql_Table in Python.
The Application Objects Tree (GRT Tree)
As mentioned previously, Workbench document data is stored in an object hierarchy. This hierarchy is known as the GRT Tree. The GRT Tree can be accessed and modified from supported external scripting languages such as Python. Care should be taken when modifying the GRT Tree, to prevent a mistake from leading to corruption of the document. Backups should be made before manipulating the tree. Read-only access to the tree is the safest approach, and is sufficient in most cases.
The main nodes in the Application Object Tree
Table 13.1. The main nodes in the Application Object Tree
|wb.registry||Application data such as plugin registry, list of editors, and options.|
|wb.customData||A generic dictionary for data you can use to store your own data. This dictionary is saved and reloaded with Workbench and is global (not document specific).|
|wb.options||Contains some default options that are used by Workbench.|
|wb.rdbmsMgmt||Internal registry of supported RDBMS modules, known data types.|
|wb.doc||The currently loaded model document.|
|wb.doc.physicalModels||The currently loaded model object, containing the database catalog and diagrams.|
|wb.doc.physicalModels.catalog||The database catalog for the model. Contains the list of schemata.|
|wb.doc.physicalModelscatalog.schemata||List of schemata in the model. Individual schema can be accessed as a list: schemata, schemata ...|
|wb.doc.physicalModels.catalog.schemata.tables (.views, .routines, ...)||Lists of tables, views, routines in the schema.|
|wb.doc.physicalModels.diagrams||List of EER diagrams in the model.|
|wb.doc.physicalModels.diagrams.figures (.layers, .connections, ...)||List of figures, layers, connections (relationships) in the diagram.|