Python support has been added to the latest version of MySQL Workbench.
In addition to Lua, you can now write scripts and modules or interact with the GRT shell using the Python language. The integration allows you to use GRT objects and modules mostly in the same way you would do with normal Python objects. The built-in
grt module contains everything related to the GRT that’s exposed to Python, including:
You can inspect these objects with the standard
dir() command and in some cases with
help(), to access
Using Perl, a stored procedure which counts to the same value is obviously not going to be as fast as bytecode languages with JIT compilers but it is a lot faster than MySQL's native SQL stored procedures. These perl stored procedures are able to perform dynamic SQL using the familiar DBD::mysql driver without any risk of self-deadlock.
Of course, you can also write stored procedures in Java for many databases but I haven't yet written the neccessary Type 2 JDBC driver to perform a in-thread connection back into the database server to be[Read more...]
Yesterday there was a short discussion on our public IRC channel (#workbench on freenode). It was about how Workbench handles Foreign-Key-Names.
Especially if you intend to use Synchronization feature (available in SE edition only) its good to have names for FKs (and their coresponding Indices). Workbench does that by default if you’re using the Relationship-tools (Hotkeys 1 to 6 when canvas is focused). But if you prefer to create your FKs in a not-so-visual way (entering the values on the FK-Tab in the table-Editor) you are on your own when it comes to naming your FKs. Though Workbench initially only accepts creating keys after you typed a name into the name-field theres still the possibility to rename the FK later to even empty names. If you try to create empty named FKs on a MySQL Server the server will generate a name for the key.
If you want to change FK names later, when your model[Read more...]
A couple of people have asked for a means to set the list of INSERT statements of a table from data already in an external file. While we haven’t implemented that feature in Workbench as of now, that’s something that can be easily added as a Lua plugin.
The plugin is really simple, but I’ll take the opportunity to use it as a quick tutorial on how to write a plugin from scratch, using the mini-IDE in Workbench 5.0 Note that this tutorial is meant for MySQL Workbench 5.0; Workbench 5.1 has some differences in how plugins are handled and that is not covered here.
1. Start Workbench and Open the “GRT Shell IDE”
2. Click on “New GRT File” button
3. Select the “Lua GRT Module File” option, “Table_Plugin” template and fill in a name for the file, eg: table_utils[Read more...]
Here is a small library with various helpful Lua functions for scripts and plugins for Workbench, making it easier to write your own plugins for exporting to some external format, generating reports etc. The library is meant for Workbench 5.0, but it will be ported to 5.1 as well, which should make transitioning plugins from one to the other somewhat easier in the future. Currently, most functions are meant for iterating through various objects so you can, but new functions will be added every once in a while and contributions, bug fixes and comments are welcome. To “install” the library, place the file in your equivalent for
C:\Documents and Settings\user\Program data\MySQL\Workbench\librariesQuick list of places to get useful information for plugin writing:
Initiated by a question on the forum I took some time to exercise my Workbench-Scripting-Knowledge. The question was, if it’s possible to do some figure-arrangement/organizing via scripts. To be more precise, the task I had to master was to get tables that have names starting with a given prefix moved into a new layer using scripts.
The function to create a new object - layer in this case - was an easy one. All you have to do is to use the function grtV.newObj(”workbench.model.Layer”). This function returns a handle to the created Layer. Finally, set the visual properties (color, position) and most important, the owner has to be set to the containing Diagram-object. Last step is to add the layer to the “layers” property of the Diagram-object.
The second step, which i put into a separate function, is to ask the user for the prefix to filter the desired tables/objects