sqls-server / sqls

SQL language server written in Go.
MIT License
956 stars 69 forks source link

How to setup for sqlite3 #161

Open raffaem opened 2 months ago

raffaem commented 2 months ago

I'm not sure how to setup for neovim and sqlite3.

I have initialized it like:

lspconfig.sqls.setup {
    on_attach = function(client, bufnr)
    require('sqls').on_attach(client, bufnr) -- require sqls.nvim
  end,
  settings = {
    sqls = {
      connections = {
        {
          driver = 'sqlite3',
          dataSourceName = '/path/to/my/db.sqlite3',
        },
      },
    },
  },
  capabilities = capabilities }

which seems not optimal as I have to change that option everytime I change db I work on.

In any case it doesn't work.

It shows a notification "no database connection".

How to set it up properly for neovim and sqlite3?

Can we add a Discussion section to this repo?

jamietanna commented 1 month ago

I believe that you need to have a ~/.config/sqls/config.yml set, i.e.:

lowercaseKeywords: false
connections:
  - alias: DMD
    driver: sqlite3
    dataSourceName: file:/home/jamie/dmd.db

You can specify multiple connections, then use :SqlsSwitchConnection to swap between the defined databases