8
I am trying to assemble a bat to create the database in the mysql server from an EER (.mwb) mysql-Workbench model, that is, in the command line, is it possible to perform this process? Someone could shed a light?
Editing:
Opening it in cmd I have the following:
MySQLWorkbench [<options>] [<name of a model file or sql script>]
Options:
--query [<connection>|<connection string>]
Open a query tab and ask for connection if nothing is specified.
If named connection is specified it will be opened,
else connection will be created based on the given connection string,
which should be in form <user>@<host>:<port>
--admin <instance> Open a administration tab to the named instance
--upgrade-mysql-dbs Open a migration wizard tab
--model <model file> Open the given EER model file
--script <sql file> Open the given SQL file in an connection, best in conjunction
with a query parameter
--run-script <file> Execute Python code from a file
--run <code> Execute the given Python code
--run-python <code> Execute the given Python code
--migration Open the Migration Wizard tab
--quit-when-done Quit Workbench when the script is done
--log-to-stderr Also log to stderr
--help, -h Show command line options and exit
--log-level=<level> Valid levels are: error, warning, info, debug1, debug2, debug3
--verbose, -v Enable diagnostics output
--version Show Workbench version number and exit
--open <file> Open the given file at startup (deprecated, use script, model etc.)
So you could use --model plus --run-script and then --quit-when-done, but in this case how would this script look, in what language? Any tips on how to write it?
Issue 2
I found a similar question in the OS in English, there really seems to be no way to do this.
https://stackoverflow.com/questions/9556330/command-line-foward-engineering-using-a-mwb-file
Issue 3
Of course there is answer, after researching I put her down there in case anyone needs.
In the Mysql Workbench documentation you can find some examples of using Python scripts: https://dev.mysql.com/doc/workbench/en/wb-scripting-shell.html. And also this link from the Workbench development team: https://dev.mysql.com/doc/workbench/en/wb--scripting-shell.html. I noticed that although Workbench accepts command line parameters, it does not run on the command line only in graphical mode.
– Celso Marigo Jr
@Celsomarigojr I’ll take a look, but if you really don’t have how I spent my 50 points but now I’m sure it’s not possible.
– Artur_Indio
@Artur_indio showed that it is possible and how to get there if you still need help in how to treat the xml file or how to mount a bat or sh file to automate the dump into mysql opens another question not to get too broad
– SneepS NinjA
Guys I managed to do, it’s really necessary the python code, and the guy I picked up put up the github code, I had even used it once but I thought I was using the methodology proposed by @Sneepsninja, then when I went to look at the source there was the python code all the time. I will wait there for someone else to try to answer, if not at the end of the bount I put my answer even without being worth anything just to help others. Thanks for all your help.
– Artur_Indio