Bug #46340 Implement 'Export' options on the commandline
Submitted: 23 Jul 2009 0:13 Modified: 24 Sep 2010 14:38
Reporter: Craig Fowler Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.1.16 OS:Any
Assigned to: Alfredo Kojima CPU Architecture:Any

[23 Jul 2009 0:13] Craig Fowler
Description:
This is a bit of a 'pipe dream' feature request, so if it's not feasible nevermind - BUT:

I think it could be cool (and to me, very useful) if workbench could export SQL CREATE (or ALTER) scripts from an .mwb file as a commandline action.

If this option were specified on the commandline then the GUI component of workbench would not load - workbench would just open and export the target .mwb file and then exit without showing/loading the GUI layer.

My use case is that I use a number of tools for designing/developing/building a database for a project.  I use workbench for designing the physical schema obects, I write my views by hand and keep them in a separate directory (I'm not so sure workbench is ready for prime-time view-writing, I just use a text editor for those) and also (since workbench isn't so great at handling it last I checked) I also keep all of my 'system' INSERTs in a separate .sql file.

I then use a bash script to build or rebuild the database from workbench's export .sql file, then import those inserts and all of the views (plus take a backup of the new database for fast restoring in application unit tests).  At the moment I need to remember to manually export a new .sql file from workbench after I make any changes (so that the .sql file picked up by the script is the latest schema design).  If I could perform a export of that .mwb to .sql from the commandline then the whole process could be automated within that script without any worries about outdated .sql exports.

I'm sure that some other use-cases could be thought up, but that's a real one that I would like it for.

Thanks (and good work on workbench so far, it's saved me so much time since I started using it, yay!)

How to repeat:
Not applicable - see request description above
[23 Jul 2009 4:45] Valeriy Kravchuk
Thank you for the feature request.
[30 Jul 2009 23:23] Alfredo Kojima
This should be possible to do from a script. We have to add a command line option to workbench to execute a script and exit.
[20 Aug 2010 2:30] Alfredo Kojima
The following command line options have been added as part of the scripting enhancements:
--admin <instance>
--query <connection>
--model <modelfile>
--script <script>
--run <code>
--quit-when-done (quits WB once --script or --run finishes)
[23 Sep 2010 16:34] Johannes Taxacher
fix confirmed in release 5.2.28
[24 Sep 2010 14:38] Tony Bedford
The 5.2.28 changelog and main documentation have been updated.