Bug #103520 Python scripting API always generate DROP SCHEMA command
Submitted: 28 Apr 2021 14:36 Modified: 6 Feb 2022 11:10
Reporter: Marek Kříž Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S3 (Non-critical)
Version:8.0.22, 8.0.28 OS:Windows
Assigned to: CPU Architecture:x86
Tags: DbMySQLFE, forward-engineering, python

[28 Apr 2021 14:36] Marek Kříž
Description:
Python scripting API always generate commands sequence:

DROP SCHEMA IF EXISTS `db` ;
CREATE SCHEMA IF NOT EXISTS `db` DEFAULT CHARACTER SET utf8mb4 ;

But when I use [Forward engineer] and set enabled (checked) option

[x] Omit schema quilifier in object names

... so .SQL script have schema section empty (DROP SCHEMA is not generated).

DbMySQLFE.generateSQLCreateStatements() API is called with parameter OmitSchemas: 1.

How to repeat:
SET WORKBENCH="C:\Program Files\MySQL\MySQL Workbench 8.0 CE\MySQLWorkbench.exe"
SET EXT=.sql
SET GENFILE=%~n1%EXT%
SET DESTFILE=%~p1%~n1%EXT%
SET OUTPUT=%~f2
if exist %OUTPUT% del %OUTPUT%
%WORKBENCH% ^
  --open %~f1 ^
  --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, {'OmitSchemas':1});fe.createScriptForCatalogObjects(os.getenv('OUTPUT'), c, {})" ^
  --quit-when-done
if exist %DESTFILE% del %DESTFILE%
rename %OUTPUT%  %GENFILE%
[1 Dec 2021 12:38] MySQL Verification Team
Hello Marek Kříž,

Thank you for the bug report.
Please upgrade to latest version and report us back if the issue still exists in latest version along with the screenshots manifesting the problem. Thanks.

Regards,
Ashwini Patil
[4 Dec 2021 11:25] Marek Kříž
Hello Ashwini Patil!

I tested all versions between 8.0.23 and 8.0.27 and these versions do no generate any .SQL script output file.

Mark
[6 Feb 2022 11:10] MySQL Verification Team
Hello Marek Kříž,

Thank you for the report and feedback.

regards,
Ashwini