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 data 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 data types integers, doubles and strings are seen as corresponding Python data types. Lists and dicts are kept in their internal representation, but can however generally be treated as Python lists and dicts, and accessed in the usual way. Objects contain data fields and methods, but the GRT only recognizes objects from a pre-registered class hierarchy.
It is possible to fully examine the classes contained within the
GRT using the Workbench Scripting Shell. Note that dots in class names are changed to
underscores in their Python counterparts. For example,
db.mysql.Table
becomes
db_mysql_Table
in Python.
The Application Objects Tree (GRT Tree)
As mentioned previously the 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 modifiying the GRT Tree, in case a mistake leads 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
Node | Description |
---|---|
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[0] | The currently loaded model object, containing the database catalog and diagrams. |
wb.doc.physicalModels[0].catalog | The database catalog for the model. Contains the list of schemata. |
wb.doc.physicalModels[0]catalog.schemata | List of schemata in the model. Individual schema can be accessed as a list: schemata[0], schemata[1] ... |
wb.doc.physicalModels[0].catalog.schemata[0].tables (.views, .routines, ...) | Lists of tables, views, routines in the schema. |
wb.doc.physicalModels[0].diagrams | List of EER diagrams in the model |
wb.doc.physicalModels[0].diagrams[0].figures (.layers, .connections, ...) | List of figures, layers, connections (relationships) in the diagram. |