I'd like to take advantage of the scripting abilities of MySQLWorkbench, but I'm having a hard time finding documentation. My first script would be automatically building a SQL create script. Around the internet the following script (with small variations) is shows up a lot of places:
```
# -*- coding: utf-8 -*-
# MySQL Workbench Python script
# Dump database to SQL file
# Written in MySQL Workbench 6.3.6
import os
import grt
from grt.modules import DbMySQLFE
c = grt.root.wb.doc.physicalModels[0].catalog
DbMySQLFE.generateSQLCreateStatements(c, c.version, {
'GenerateDrops' : 1,
'GenerateSchemaDrops' : 1,
'OmitSchemata' : 1,
'GenerateUse' : 1
})
DbMySQLFE.generateSQLCreateStatements(c, c.version, {})
DbMySQLFE.createScriptForCatalogObjects(os.path.dirname(grt.root.wb.docPath) + '/ddl.sql', c, {})
```
This is a good start--a create script is indeed generated, however, it includes dropping tables before creating them (instead of CREATE IF NOT EXISTS).
I can find no documentation of the third argument (options) to DbMySQLFE.generateSQLCreateStatements. Furthermore, changing the value of 'GenerateDrops' to 0, false or anything else doesn't seem to have any effect on the generated file. In fact, I see no effect of changing *any* of the options.
Where can I find documentation? Is the source available somewhere?
```
# -*- coding: utf-8 -*-
# MySQL Workbench Python script
# Dump database to SQL file
# Written in MySQL Workbench 6.3.6
import os
import grt
from grt.modules import DbMySQLFE
c = grt.root.wb.doc.physicalModels[0].catalog
DbMySQLFE.generateSQLCreateStatements(c, c.version, {
'GenerateDrops' : 1,
'GenerateSchemaDrops' : 1,
'OmitSchemata' : 1,
'GenerateUse' : 1
})
DbMySQLFE.generateSQLCreateStatements(c, c.version, {})
DbMySQLFE.createScriptForCatalogObjects(os.path.dirname(grt.root.wb.docPath) + '/ddl.sql', c, {})
```
This is a good start--a create script is indeed generated, however, it includes dropping tables before creating them (instead of CREATE IF NOT EXISTS).
I can find no documentation of the third argument (options) to DbMySQLFE.generateSQLCreateStatements. Furthermore, changing the value of 'GenerateDrops' to 0, false or anything else doesn't seem to have any effect on the generated file. In fact, I see no effect of changing *any* of the options.
Where can I find documentation? Is the source available somewhere?