Emacs client for sqltoolsservice (port of vscode-mssql)
Install lsp-mode and lsp-treemacs clone the repo and add the following lines in your config:
(add-to-load-path ".../lsp-mssql/")
(require 'lsp-mssql)
(add-hook 'sql-mode-hook 'lsp)Confgure the connections.
(setq lsp-mssql-connections
[(:server "localhost"
:database ""
:user "SA"
:password "demoPWD2")])Open a *.sql file and do M-x lsp. On the first run, it will ask you
whether to install the language server. Then when you are in the sql buffer
do M-x lsp-mssql-connect which will ask you to select connection. After the
connection is established the current buffer will be associated with the SQL
Server and the completion and the query exection will be performed against
that server.
lsp-mssql also supports Azure MSSQL. To connect using Service
Principals, you need to use raw connection string:
(setq lsp-mssql-connections
[(:server "SERVER-NAME.database.windows.net"
:connectionString "SERVER=SERVER-NAME.database.windows.net;DATABASE=...;UID=...;PWD=...;AUTHENTICATION=ActiveDirectoryServicePrincipal")])- Editor
lsp-mssql-connect- connect the editor toMSSQL server.lsp-mssql-disconnect- disconnect the editorMSSQL server.lsp-mssql-execute-buffer- execute current bufferlsp-mssql-execute-region- execute selected region.
- MSSQL Object Explorer
lsp-mssql-object-explorer- displayMSSQLobject explorer to the right.lsp-mssql-object-explorer-connect- connect the connection under point. Bound toCin the object explorer.lsp-mssql-object-explorer-refresh- refresh the node. Bound toRin the object explorer.
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=demoPWD2" \
-p 1433:1433 --name sql1 \
-d mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04snippets directory contains the snippets from vscode-mssql.
(add-to-list 'yas-snippets-dir "path to stippets dir.")- Implement disconnect.
- Implement cancel query
- Provide options to customize the output
