Description:
I want to use mysql-workbench to automatically generate a schema from an .mwb file, and I want the resulting SQL script not to contain the database name in table names, i.e, to have the same effect as when I check the "Omit Schema Qualifier in Object Names". As I could see from examining mysql-workbench's code on Github, I should use the 'OmitSchemata': 1 parameter in a python script. I attached the bash script that calls a python script I use to generate the SQL file.
The problem is that even when I set 'OmitSchemata': 1, table names still have database name.
In short, I want this:
CREATE TABLE IF NOT EXISTS `task` (
but I get this:
CREATE TABLE IF NOT EXISTS `workload-tool`.`task` (
It seems to me that 'OmitSchemata' option doesn't do what it is supposed to do.
How to repeat:
#!/usr/bin/env bash
mysql-workbench \
database-model.mwb \
--run-python "
import os
import grt
from grt.modules import DbMySQLFE as fe
c = grt.root.wb.doc.physicalModels[0].catalog
fe.generateSQLCreateStatements(c, c.version, {
'OmitSchemata' : 1
})
fe.generateSQLCreateStatements(c, c.version, {})
# This is the file path for stdout of the current process:
stdout = '/proc/' + str(os.getpid()) + '/fd/1'
fe.createScriptForCatalogObjects(stdout, c, { })" \
--quit-when-done
Description: I want to use mysql-workbench to automatically generate a schema from an .mwb file, and I want the resulting SQL script not to contain the database name in table names, i.e, to have the same effect as when I check the "Omit Schema Qualifier in Object Names". As I could see from examining mysql-workbench's code on Github, I should use the 'OmitSchemata': 1 parameter in a python script. I attached the bash script that calls a python script I use to generate the SQL file. The problem is that even when I set 'OmitSchemata': 1, table names still have database name. In short, I want this: CREATE TABLE IF NOT EXISTS `task` ( but I get this: CREATE TABLE IF NOT EXISTS `workload-tool`.`task` ( It seems to me that 'OmitSchemata' option doesn't do what it is supposed to do. How to repeat: #!/usr/bin/env bash mysql-workbench \ database-model.mwb \ --run-python " import os import grt from grt.modules import DbMySQLFE as fe c = grt.root.wb.doc.physicalModels[0].catalog fe.generateSQLCreateStatements(c, c.version, { 'OmitSchemata' : 1 }) fe.generateSQLCreateStatements(c, c.version, {}) # This is the file path for stdout of the current process: stdout = '/proc/' + str(os.getpid()) + '/fd/1' fe.createScriptForCatalogObjects(stdout, c, { })" \ --quit-when-done