Skip to content

kitagry/bqls.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

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

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.

execute-query.mp4

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

About

Neovim plugin for bqls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages