Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created June 24, 2022 21:29
Show Gist options
  • Save Velrok/d2848d988247beb9d0b90ec1e64a901a to your computer and use it in GitHub Desktop.
Save Velrok/d2848d988247beb9d0b90ec1e64a901a to your computer and use it in GitHub Desktop.
NeoVim BigQuery integration. Sends current file content as query to BQ and opens result in terminal split with VisiData.
#!/usr/bin/env bash
set -e
query_file="$1"
# use json instead of csv, because I had an error where BQ complained it could not render a field as csv table
bq query --format json --headless -sync -quiet < "$query_file" 2>/dev/null \
| vd --filetype json
command! RunAsBigQuery :split term://bq-vd %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment