sq data wrangler
Go to file
2020-08-06 11:42:30 -06:00
.github/workflows Create go.yml 2020-03-03 03:19:04 -07:00
cmd mostly tidyup 2016-10-21 21:11:19 -06:00
grammar working on grammar 2016-10-30 16:35:56 -06:00
libsq working on grammar 2016-10-30 16:35:56 -06:00
test mostly build stuff (#40) 2016-10-21 13:29:21 -06:00
tools working on grammar 2016-10-30 16:35:56 -06:00
vendor tidy up 2016-10-16 22:14:01 -06:00
.editorconfig tidy up 2016-10-16 22:14:01 -06:00
.gitignore tidy up 2016-10-16 22:14:01 -06:00
Dockerfile tidy up 2016-10-16 22:14:01 -06:00
LICENSE tidy up 2016-10-16 22:14:01 -06:00
main.go mostly tidyup 2016-10-21 21:11:19 -06:00
Makefile mostly tidyup 2016-10-21 21:11:19 -06:00
README.md mostly tidyup 2016-10-21 21:11:19 -06:00
test.sh mostly tidyup 2016-10-21 21:11:19 -06:00

sq: simple queryer for structured data

sq is a command-line tool that provides uniform access to structured data sources. This includes traditional SQL-style databases, or document formats such as JSON, XML, Excel etc.

> sq '.user | .uid, .username, .email'
[
  {
    "uid": 1,
    "username": "neilotoole",
    "email": "neilotoole@apache.org"
  },
  {
    "uid": 2,
    "username": "ksoze",
    "email": "kaiser@soze.org"
  },
  {
    "uid": 3,
    "username": "kubla",
    "email": "kubla@khan.mn"
  }
]

sq defines its own query language, seen above, formally known as SLQ.

For usage information or to download the binaries, see the sq manual.

Development

These steps are for Mac OS X (tested on El Capitan 10.11.16). The examples assume username ksoze.

Prerequisites

  • brew
  • Xcode dev tools.
  • jq brew install jq 1.5
  • Go brew install go 1.7.1
  • Docker
  • Java is required if you're working on the SLQ grammar.

Fork

Fork this repo, e.g. to https://github.com/ksoze/sq.

Clone the forked repo and set the upstream remote:

mkdir -p $GOPATH/src/github.com/neilotoole
cd $GOPATH/src/github.com/neilotoole
git clone https://github.com/ksoze/sq.git
cd ./sq
git remote add upstream https://github.com/neilotoole/sq.git
# verify that the remote was set
git remote -v

Make

From $GOPATH/src/github.com/neilotoole/sq, run ./test.sh. This will run make test inside a docker container.

For developing locally, this sequence should get you started:

make install-go-tools
make start-test-containers
make test
make install
make smoke
make dist

Note that running these steps may take some time (in particular due the use of Cgo and cross-compiling distributables). Try sq ls. Note that by default sq uses ~/.sq/sq.yml as its config store, and outputs debug logs to ~/.sq/sq.log.

Assuming the test containers are running (make start-test-containers), this workflow is suggested:

  • Make your changes
  • Run make test && make install && make smoke

Contributing

When your changes are ready and tested, run make dist and a final make smoke. Push the changes to your own fork, and then open a PR against the upstream repo. The PR should include a link to the GitHub issue(s) that it addresses, and it must include the output of make smoke.