README.md

August 11, 2025 ยท View on GitHub

bqls.nvim

Neovim plugin for BigQuery Language Server.

Prerequisites

Before using this plugin, you need to install the bqls language server:

Requirements

  • Go 1.16 or later
  • CGO enabled (CGO_ENABLED=1)
  • Recommended: clang++ compiler

Installation

  1. Install from Releases (Recommended): Download the latest binary from GitHub Releases and place it in your PATH.

  2. Build from Source:

    export CGO_ENABLED=1
    export CXX=clang++
    go install github.com/kitagry/bqls@latest
    

Authentication

Login to BigQuery API:

gcloud auth login
gcloud auth application-default login

Setting

If using neovim >=0.11

vim.lsp.config("bqls", {
    settings = {
        project_id = "YOUR_PROJECT_ID",
        location = "YOUR_LOCATION",
    },
})

vim.lsp.enable("bqls")

If using neovim <0.10

require("lspconfig").bqls.setup({
  settings = {
    project_id = "YOUR_PROJECT_ID",
    location = "YOUR_LOCATION"
  }
})

If you change project_id or location after vim started:

vim.lsp.buf_notify(0, "workspace/didChangeConfiguration", {
  settings = {
    project_id = "ANOTHER_PROJECT_ID",
    location = "ANOTHER_LOCATION"
  }
})

Execute Query

You can choose lua vim.lsp.buf.code_action(). In order to save result to local file, you can use :BqlsSave ./path/to/file.csv.

https://github.com/user-attachments/assets/2f5aef83-f341-4c04-bb37-88db45badb6d

BigQuery Explorer

If you want to show by neo-tree.

require("neo-tree").setup({
    sources = {
      "filesystem",
      "buffers",
      "git_status",
      "bqls"
    },
    bqls = {
      project_ids = { "YOUR_GOOGLE_CLOUD_PROJECT_ID1", "YOUR_GOOGLE_CLOUD_PROJECT_ID2" },  -- default is {"bigquery-public-data"}
    },
})

And then, you can open dataset and table by :Neotree bqls.

image