Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

sqls

> 编程语言
Open source

SQL language server written in Go.

1.3K stars0 likes0 views
WebsiteGitHub

About

SQL language server written in Go.

sqls: SQL Language Server

An implementation of the Language Server Protocol for SQL.

Note

This project is currently under development and there is no stable release. Therefore, destructive interface changes and configuration changes are expected.

Features

sqls aims to provide advanced intelligence for you to edit sql in your own editor.

Support RDBMS

  • MySQL(Go-MySQL-Driver)
  • PostgreSQL(pgx)
  • SQLite3(go-sqlite3)
  • MSSQL(go-mssqldb)
  • H2(pgx)
  • Vertica(vertica-sql-go)

Language Server Features

Auto Completion

  • DML(Data Manipulation Language)
    • SELECT
      • Sub Query
    • INSERT
    • UPDATE
    • DELETE
  • DDL(Data Definition Language)
    • CREATE TABLE
    • ALTER TABLE

Join completion

If the tables are connected with a foreign key sqls can complete JOIN statements

CodeAction

  • Execute SQL
  • Explain SQL
  • Switch Connection(Selected Database Connection)
  • Switch Database

Hover

Signature Help

Document Formatting

Installation

bash
go install github.com/sqls-server/sqls@latest

Editor Plugins

  • sqls.vim
  • vscode-sqls
  • sqls.nvim
  • Emacs LSP mode

DB Configuration

The connection to the RDBMS is essential to take advantage of the functionality provided by sqls. You need to set the connection to the RDBMS.

Configuration Methods

There are the following methods for RDBMS connection settings, and they are prioritized in order from the top. Whichever method you choose, the settings you make will remain the same.

  1. Configuration file specified by the -config flag
  2. workspace/configuration set to LSP client
  3. Configuration file located in the following location
    • $XDG_CONFIG_HOME/sqls/config.yml ("$HOME/.config" is used instead of $XDG_CONFIG_HOME if it's not set)

Configuration file sample

…

Workspace configuration Sample

  • setting example with vim-lsp.
…
  • setting example with coc.nvim.

In coc-settings.json opened by :CocConfig

json
{
    "languageserver": {
        "sql": {
            "command": "sqls",
            "args": ["-config", "$HOME/.config/sqls/config.yml"],
            "filetypes": ["sql"],
            "shell": true
        }
    }
}
  • setting example with nvim-lspconfig.
lua
require'lspconfig'.sqls.setup{
  on_attach = function(client, bufnr)
    require('sqls').on_attach(client, bufnr) -- require sqls.nvim
  end
  settings = {
    sqls = {
      connections = {
        {
          driver = 'mysql',
          dataSourceName = 'root:root@tcp(127.0.0.1:13306)/world',
        },
        {
          driver = 'postgresql',
          dataSourceName = 'host=127.0.0.1 port=15432 user=postgres password=mysecretpassword1234 dbname=dvdrental sslmode=disable',
        },
      },
    },
  },
}
  • Setting example for Sublime Text 4

    Install the LSP Client by Opening the command palette and run Package Control: Install Package, then select LSP.

    Open Preferences > Package Settings > LSP > Settings and add the "sqls" client configuration to the "clients":

{
    "show_diagnostics_count_in_view_status": true,
    "clients": {
        "sqls": {
            "enabled": true,
            "command": ["/path/to/sqls binary"],
            "selector": "source.sql"
        }
    }
}

I'm sorry. Please wait a little longer for other editor settings.

Configuration Parameters

The first setting in connections is the default connection.

Key Description
connections Database connections

connections

dataSourceName takes precedence over the value set in proto, user, passwd, host, port, dbName, params.

Key Description
alias Connection alias name. Optional.
driver mysql, postgresql, sqlite3, mssql, h2. Required.
dataSourceName Data source name.
proto tcp, udp, unix.
user User name
passwd Password
host Host
port Port
path unix socket path
dbName Database name
params Option params. Optional.
sshConfig ssh config. Optional.

sshConfig

Key Description
host ssh host. Required.
port ssh port. Required.
user ssh user. Optional.
privateKey private key path. Required.
passPhrase passPhrase. Optional.

DSN (Data Source Name)

See also.

Contributors

This project exists thanks to all the people who contribute.

Inspired

I created sqls inspired by the following OSS.

  • dbcli Tools
    • mycli
    • pgcli
    • litecli
  • non-validating SQL parser
    • sqlparse

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goautocompletelanguage-serverlanguage-server-protocolsql

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言