sponsor Vim development Vim logo Vim Book Ad

Vim SQL Workbench : Provides sql access from vim to any DBMS

 script karma  Rating 75/29, Downloaded by 10599  Comments, bugs, improvements  Vim wiki

created by
Cosmin Popescu
 
script type
utility
 
description
This is an implementation of SQL Workbench/J (http://www.sql-workbench.net/)
in VIM. It works with any DBMS supported by SQL Workbench/J (PostgreSQL,
Oracle, SQLite, MySQL, SQL Server etc.). See the complete list here: http://www.sql-workbench.net/databases.html.

You can connect to any DBMS directly from VIM.

Features:

* database explorer (e.g.: table lists, procedures list, views list, triggers
  list), extensible (you can have your own objects list)
* SQL buffer with powerful intellisense autocomplete
* export any sql statement as `text`, `sqlinsert`, `sqlupdate`,
  `sqldeleteinsert`, `xml`, `ods`, `html`, `json`
* search in object source
* search in table or views data
* transactions straight out from VIM
* fully customizable

More details can be found here: https://github.com/cosminadrianpopescu/vim-sql-workbench
 
install details
Install using any package manager or copying the files inside $HOME/.vim
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-sql-workbench.tar.gz 8.2.2 2022-08-19 8.2 Cosmin Popescu * better handling of the temporary files
* bug fix: the settings file of `SQL Workbench/J` would be overriden if the `sqlwbconsole` process would get killed
* bug fix: when changing the profile, the autocomplete options would not change
* fixed the background run
* dbexplorer: now the references is based on the generated report
* added support for `wb-profiles.properties` file
* added support for master password
* `SWSqlExecuteSelected` now supports ranges
* minimum version of `SQL Workbench/J` is now 128
vim-sql-workbench.tar.gz 8.2.1 2018-09-19 7.4 Cosmin Popescu * Fixed the latest problem reported on github issue #25
vim-sql-workbench.tar.gz 8.2 2018-04-18 7.4 Cosmin Popescu * added the `SWInclude` command
* added an alternate delimiter when executting an sql
* when doing `desc <table>`, the columns are displayed before indexes now
(issue #29)
* when switching to the results buffer automatically, do a `keepalt` before
(issue #36)
* when doing `SWInclude` from an unconnected buffer, give a proper error
message (issue #35)
vim-sql-workbench.tar.gz 8.1 2018-03-21 7.4 Cosmin Popescu * fixed documentation issues
* added the `CtrlPSW` command (will open CtrlP with the SW profiles)
* added the `CtrlPClearSWCache` command (will parse profiles from scratch
when opening CtrlP)
* fixed the spaces in profiles name (CtrlP will fail if there was a space in
the profile name or in the group name)
* switch back the autocomplete to `<C-x><C-o>` for compatibility with
`YouCompleteMe`
* fixed case sensitiviness in the column names in the result set (will not
filter or hide columns because of it)
* fixed quote issue in the profile names (having a single quote in a profile
name would break `CtrlP` and any profiles completion)
vim-sql-workbench.tar.gz 8.0 2017-11-22 7.0 Cosmin Popescu * for autocomplete, added all fields
* for autocomplete, in fields insert, added the db type of the field
* for autocomplete, fixed several bugs (now it's working also for subqueries)
* for autocomplete, improved the caching
* for autocomplete, for insert, in the fields part, once a field is inserted,
the next autocomplete will not return it.
* added autocomplete for macros
* for autocomplete, when a subquery is found, is returned as `subquery`,
instead of `#ALIAS#` in the completion menu
* added the possibility to cache several `wbschemaexports`
* added the possibility to follow all the references of a resultset (which
rows is the current row referecing and which rows from other tables are
referencing the current row): see `SWSqlReferences` and `SWSqlReferencedBy`
* added the possibility to fetch the references tree only until a certain
level
* for filtering and hiding columns, a new query is sent to the database now
* when in an sql buffer, on an insert, if you are in the fields part, you can
see the corresponding value and when on a value in the values part, you can
see the corresponding column (see SWSqlMatch)
* now, you can execute macros just like a query (so no shortcut for
`SWSqlExecuteMacro`); you can do `<leader>c-<space>` on a macro and is going
to be interpreted correctly
* you can now get the sql behind a macro (see `SWSqlGetMacroSql)
* you can choose now to send to the server the macro `sql` query rather than
the macro (see `g:sw_prefer_sql_over_macro` option)
* when autocompleting the list of columns (for example for `SWSqlFilter`), now
for identical identifiers the table part will be added in paranthesis after
the column name
* now, when filtering, you can directly insert the insert sql part for the
current resultset (see `SWSqlFilter`)
* added the `SWSqlGenerateInsert` command, which will generate an insert which
will be coppied in the clipboard
* commands removed: `SWSqlExecuteMacro`, `SWSqlShowOnlyColumn`,
`SWSqlForeignKey`, `SWSqlFilterColumn`, `SWSqlUnfilterColumn`,
`SWSqlRemoveAllFilters`
* commands added: `SWSqlReferences`, `SWSqlReferencedBy`, `SWSqlFilter`,
`SWSqlUnfilter`, `SWSqlGenerateInsert`, `SWSqlGetMacroSql`,
`SWSqlInsertMatch`
* added `dbext` comparison
vim-sql-workbench.tar.gz 7.1.2 2017-08-08 7.0 Cosmin Popescu * updated the doc to specify the `g:sw_plugin_path` variable
* fixed the `g:sw_cache` variable bug declaration
vim-sql-workbench.tar.gz 7.1.1 2017-08-06 7.0 Cosmin Popescu * renamed variable `g:sw_autocomplete_cache_dir` to `g:sw_cache`
* fixed issue #24
vim-sql-workbench.tar.gz 7.1 2017-07-31 7.0 Cosmin Popescu * fixed issue #23
* added `exit` event for the sql buffer
vim-sql-workbench.tar.gz 7.0 2017-07-27 7.0 Cosmin Popescu * profiles are automatically parsed
* revamped autocomplete: no more commands needed (just set the report option,
see the `schema report` section from the documentation)
* based tables metadata on the schema report generated by `WbSchemaReport`
* added the `report` and `use-report` option to the profiles
* added events in the sql buffer (`new_instance` and `profile_changed`)
* added the possibility to share a buffer connection (see
`SWSqlBufferShareConnection`)
* added the possibility to go to the reference source in a result set (see the
`SWSqlForeignKey` command)
* removed the `SWSqlAutocomplete...` commands (not necessary anymore)
* in the db explorer added references tree (see `Referenced by` and
`References` options)
* added the `<leader><c-space>` shortcut in the result set window (will
refresh the currently selected result set)
vim-sql-workbench.tar.gz 6.3 2016-12-23 7.4 Cosmin Popescu * now if you set the g:sw_config_dir, this is also sent to `SQL Workbench/J` (please note that this only works now with build 121.4 and more)
* better folding of the resultsets
* added the possibility to refresh a resultset (see `SWSqlRefreshResultSet`)
* added the possibility to delete a resultset from the resultsets window (see `SWSqlDeleteResultSet`)
vim-sql-workbench.tar.gz 6.2.1 2016-11-01 8.0 Cosmin Popescu * minor bug fix
vim-sql-workbench.tar.gz 6.2 2016-11-01 8.0 Cosmin Popescu * added caching for the database explorer
* added folding for the database explorer columns
* added the possibility to kill the current statement
* several fixed when working with channels
* fixed a bug in integration with airline
* merging the pull request 1
vim-sql-workbench.tar.gz 6.1 2016-09-29 8.0 Cosmin Popescu This version will break the compatibility with VIM 7. So, before installing
this new version, please upgrade to VIM 8.

Changes:

* fixed the tutorial in the documentation
* added support for neovim
* added events for the database explorer
* added the filter data option for the database explorer objects
* beffer hiding of the empty lines in resultsets with columns hidden
* dropped the support for variables (you should only use `wbvardef` from SQL Workbench)
* now the database explorer will not open by default the first tab (you have to specify which tab you want to open, once the database explorer is connected to a DBMS)
vim-sql-workbench.tar.gz 6.0 2016-09-25 7.4 Cosmin Popescu This version will break the compatibility with VIM 7. So, before installing
this new version, please upgrade to VIM 8.

Changes:

* vim8 required
* python not needed anymore
* every operation is now aynchronous
* added the possibility to add a custom panel to an existing tab in the dbexplorer
* fixed the search which was not working
* eliminated the possibility to select columns to display in search (now you can use anyway :SWSqlShoOnlyColumns command)
* logging the interaction with SQL Workbench/J
* added a timer for commands being executed using vim8 timers
* now each buffer has its own connection to the DBMS (this means that each buffer has it's own transaction, also)
* added the possibility to disconnect a buffer from SQL Workbench/J
* integraton with CtrlP
* integration with Airline
* added the possibility to display the current connection in the status line
* added the possibility to check all connected buffers to the DBMS (see SWSqlShowActiveConnections command)
* removed the support for the sessions (it was not that usefull anyway)
* improved the filtering
* now each buffer has it's own resultset
* added the possibility to clear the resultsets for one buffer or for all at once (see SWSqlWipeoutResultsSets command)
* added the possibility to open the resultset window without executing any command
* added SWSqlGetSqlCount (which will return the number of rows of the current sql)
* removed commands: SWDbExplorerRestore, SWSqlConnectToServer, SWSqlBufferRestore
* new commands: SWSqlBufferConnect, SWSqlBufferDisconnect, SWSqlGetSqlCount, SWSqlGetObjRows, SWSqlShowActiveConnections, SWSqlShoLog, SWSqlShowLastResultset
* new options: sw_log_to_file, sw_command_timer
* removed options: sw_search_default_result_columns
* added a default shortcut to execute a macro
* added a default shortcut to get the number of rows for the current sql
vim-sql-workbench.tar.gz 5.2.2 2016-06-23 7.0 Cosmin Popescu * Added the SWSqlExecuteMacro command
* Changed the trigger sources command (works with `SQL Workbench/J` build 119
and up)
* Updated to work with `SQL Workbench/J` build 119
* Added highlight in the resultset window for Oracle errors
* Added the possibility to save the resultsets (see `SWSqlWipeoutResultsSets`
command)
vim-sql-workbench.tar.gz 5.2.1 2016-03-04 7.0 Cosmin Popescu * better header display for resultsets
* better folding
* now the command which generated a resultset is displayed in the header
vim-sql-workbench.tar.gz 5.2 2016-03-03 7.0 Cosmin Popescu * hightlight the resultsets headers (in dbexplorer and sql window)
* possibility to toggle form display in the dbexplorer (see the `SWDbExplorerToggleFormDisplay` command)
* fixed some bugs in the filtering of the rows
* improved the filtering and the hiding of the columns (faster now)
* added the folds in the resultset window (each resulset can be folded now)
vim-sql-workbench.tar.gz 5.1 2016-02-22 7.0 Cosmin Popescu * possibility to autocomplete server ports
* better display of results for asynchronious results
* better delimiting of the resultsets
* the resultsets are not displayed continous as long as the results window is
  opened
* added option to switch to results tab or not
* added support to display resultsets one next to another (not implemented
  yet)
* added filtering of the resultsets (see the `SWSqlFilterColumn`,
  `SWSqlUnfilterColumn` and `SWSqlRemoveAllFilters` commands)
* added the possibility to hide and show columns (see the
  `SWSqlShowAllColumns`, `SWSqlShowOnlyColumn`, `SWSqlShowOnlyColumns`,
`SWSqlShowColumn` and `SWSqlHideColumn` commands)
* better interactivity with the `SQL Workbench/J` server
vim-sql-workbench.tar.gz 5.0.1 2015-11-22 7.0 Cosmin Popescu * Added a short tutorial in the documentation
vim-sql-workbench.tar.gz 5.0 2015-11-18 7.0 Cosmin Popescu * Use the `SQL Workbench/J` profiling instead of the profiling generated in `sqlwbserver`
* Use the `SQL Workbench/J` interactivity. This means:
  * the possibility to use `$[?var]` parameters or `$[&var]` parameters (see http://www.sql-workbench.net/manual/using-variables.html)
  * possible to have profiles without the password being saved in the profile (see http://www.sql-workbench.net/manual/profiles.html#profile-workbench-settings)
  * possible to have profiles without the username being specified int the profile (see http://www.sql-workbench.net/manual/profiles.html#profile-workbench-settings)
  * possible to have confirmation for data editing (see http://www.sql-workbench.net/manual/options.html#options-data-edit)
* renamed the `sqlworkbench` to `sqlworkbench.py`
* moved all `python` resources in the `resources/py` folder
* added a check to return a nice error if you try to run an sql statement from a non sql buffer
* fixed the database explorer (checks before each command that a connection exists and if not opens a new one)


`sqlworkbench.py` is not compatible with `SQL Workbench/J` prior to build 118. To use build 117 and before you have to start `sqlworkbench.py` with the `-O 1` parameter
vim-sql-workbench.tar.gz 4.0.2 2015-10-28 7.0 Cosmin Popescu * Nicer error when executing operation in a non workbench buffer
* Removed the <C-i> shortcut in the buffer results
* fixed the sqlwbserver to work with h2 databases
vim-sql-workbench.tar.gz 4.0.1 2015-09-27 7.0 Cosmin Popescu * made the change_tab function public (this means it is now possible to create commands using this function)
* fixed a display results bug
* fixed the utf-8 characters in the results tab
* added the `package status` in the Oracle packages
* added the `-l` option in the sqlwbserver (create a file with detailed debug informations about the requests to the server)
vim-sql-workbench.tar.gz 4.0 2015-08-20 7.0 Cosmin Popescu * made it compatible with latest SQL Workbench/J build
* now postgresql works by default (no need for another dbexplorer)
* added the possibility to have dbexplorers options per DBMS type
* added the possibility to have a vimscript function called by the dbexplorer
* added some profiling
* better display of error messages
* improved the sqlwbserver (now it should quit gracefully, without errors)
vim-sql-workbench.tar.gz 3.3 2015-08-15 7.0 Cosmin Popescu * Added the g:sw_switch_to_results_tab option (whether or not to switch to results tab after a command)
* Improvements in the sqlwbserver python console
* Improved documentation, using vim-tools (http://peterodding.com/code/vim/tools)
* Changed the handling of the user defined variables (move towards using WbVarDef)
* Possibility to send command to the DBMS from vim command line. So, now you can have shortcuts for sql queries, like wbdisplay record
* Autocomplete for the WbConnect command
vim-sql-workbench.tar.gz 3.2.2 2015-08-08 7.0 Cosmin Popescu Small fix: fixed the variables (they were not working with standard modifiers)
vim-sql-workbench.tar.gz 3.2.1 2015-08-04 7.0 Cosmin Popescu Just a minor release:
* Fixed issue #6
vim-sql-workbench.tar.gz 3.2 2015-04-23 7.0 Cosmin Popescu * Added the possibility to have multiple columns replaced in the database explorer
* Updated the documentation
* Added the resources/dbexplorer-postgresql.vim database explorer for usage with PostgreSQL
vim-sql-workbench.tar.gz 3.1.1 2015-04-20 7.0 Cosmin Popescu * fixed issue #9
vim-sql-workbench.tar.gz 3.1 2015-04-16 7.0 Cosmin Popescu * Added the `SWDbExplorerReconnect` command (for reconnecting a dbexplorer timeout session, where you cannot do `wbconnect`)
* Changed the autocomplete from omni function to userfunction (use `<C-x><C-u>` instead of `<C-x><C-o>` for intellisense autocomplete)
* Fixed github #7 issue
* Set the maximum number of rows to 100 for dbexplorer to the connection lever rather then to each command level
* Fixed github #9 issue
vim-sql-workbench.tar.gz 3.0 2015-04-01 7.0 Cosmin Popescu * Switch to using sqlwbserver for improved performance
* Lots of new commands (like SWSqlAutocompleteLoad or SWSqlAutocompletePersist).
* added python dependency (needed for using sqlwbserver)
* Some commands became obsolete (like SWSqlOpen)
* fixed issue #4

vim-sql-workbench.tar.gz 2.0 2015-03-19 7.0 Cosmin Popescu * Fixed #2 issue
* Added transactions
vim-sql-workbench.tar.gz 1.3 2015-03-08 7.0 Cosmin Popescu The autocomplete is now persisted on the hard drive. This means that it can be loaded automatically every time you open a buffer for a given profile.

Deprecated methods:

    SWSqlAutocompleteSetDefault
    SWSqlAutocompleteWithDefault

vim-sql-workbench.tar.gz 1.2 2015-03-07 7.0 Cosmin Popescu * Added variables (parameter substitution when sending sql queries to the DBMS).
When sending a query to the DBMS, you can use named parameters. For example "select * from table where name = :name". You will be asked to provide the value of the name parameter
vim-sql-workbench.tar.gz 1.1.3 2015-03-01 7.0 Cosmin Popescu * Solved github issue 5 (https://github.com/cosminadrianpopescu/vim-sql-workbench/issues/5)
vim-sql-workbench.tar.gz 1.1.2 2015-02-28 7.0 Cosmin Popescu * Improved autocomplete (updated some regex patterns and fixed some small bugs)
* Updated the vim help documentation
* Added the g:sw_delete option
vim-sql-workbench.tar.gz 1.1.1 2015-02-03 7.0 Cosmin Popescu Fixed issue #3 (see github). For the moment please use SQL Workbench/J build 116 and prior. There seems to be a problem with build 117, but I cannot reproduce it yet.
vim-sql-workbench.tar.gz 1.1 2015-01-18 7.0 Cosmin Popescu Added asynchronous functionality. Now you can run your commands asynchronous.
Fixed small bugs
vim-sql-workbench.tar.gz 1.0.2 2015-01-12 7.0 Cosmin Popescu Fixed the issue #1 on github + fixed some autocomplete bugs
vim-sqlworkbench.tar.gz 1.0.1 2015-01-09 7.0 Cosmin Popescu Fixed some autocomplete bugs
vim-sqlworkbench.tar.gz 1.0 2015-01-08 7.0 Cosmin Popescu Initial upload
ip used for rating: 54.234.146.26

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github