Bug #90313 OmitSchemata option in Python scripts doesn't work when generating schema SQL
Submitted: 5 Apr 2018 17:10 Modified: 6 Apr 2018 5:43
Reporter: Omit Schemata Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S3 (Non-critical)
Version:MySQL Workbench CE (GPL) 6.3.8 CE build OS:Debian (Debian Sid)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: python, scripting

[5 Apr 2018 17:10] Omit Schemata
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
[6 Apr 2018 5:43] MySQL Verification Team
Thank you for the report and feedback.
This is duplicate of Bug #84390, please see Bug #84390

Thanks,
Umesh