Metadata-Version: 2.1
Name: sql-lsp
Version: 0.0.5
Summary: 
Author: Chahak Mehta
Author-email: chahakmehta013@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: mysql-connector (>=8.2.0,<9.0.0)
Requires-Dist: pygls (>=1.1.1,<2.0.0)
Requires-Dist: sqlfluff (>=2.3.5,<3.0.0)
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
Description-Content-Type: text/markdown

# sql-lsp

A language server for SQL. This server currently supports only MySQL 
(and MariaDB) for now with plans to add more dialects in the future. This 
package is under active development and doesn't not have a stable release yet
but any use and feedback is highly appreciated!

## Installation

This package provides `sql-ls` which is a language server written with the help
of [`pygls`](https://github.com/openlawlibrary/pygls). It can be installed
directly using `pip`

``` shell
pip install sql-lsp
```

## Features and Usage

The language server can be used by starting in the `stdio` mode

``` shell
sql-ls --stdio
```

The server gets the completion information by connecting to the database and
fetching the metadata regarding the tables. The database connection is
configured based on connections provided in the configuration file for the
project. The server expects `.sql-ls/config.json` at the root of the project.
An example `config.json`

``` json
{
  "connections": {
    "localhost": {
      "driver": "mariadb",
      "host": "localhost",
      "username": "username",
      "password": "password",
      "database": "mysql"
    }
  }
}
```

The connections can be switched using the `Switch Connection` code action.

`sql-ls` provides completion and query execution.

## Editor Integration

### Emacs

This server integrates well with the `eglot` language server client. Once the
server in installed, it can be configured for `sql-mode` by adding the following
configuration

``` emacs-lisp
(add-to-list 'eglot-server-programs
               '((sql-mode)
                 . ("sql-ls" "--stdio")))
```


