Neovim plugin for BigQuery Language Server.
Before using this plugin, you need to install the bqls language server:
- Go 1.16 or later
- CGO enabled (
CGO_ENABLED=1
) - Recommended:
clang++
compiler
-
Install from Releases (Recommended): Download the latest binary from GitHub Releases and place it in your PATH.
-
Build from Source:
export CGO_ENABLED=1 export CXX=clang++ go install github.com/kitagry/bqls@latest
Login to BigQuery API:
gcloud auth login
gcloud auth application-default login
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"
}
})
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
.
execute-query.mp4
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
.