sq data wrangler
Go to file
2016-10-21 10:56:48 -06:00
cmd removing assets from VCS 2016-10-21 10:56:48 -06:00
grammar tidy up 2016-10-16 22:14:01 -06:00
libsq cleaning up build system (#38) 2016-10-21 10:14:48 -06:00
test making the build system work (#33) 2016-10-17 05:05:48 -06:00
tools tidy up 2016-10-16 22:14:01 -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 tidy up 2016-10-16 22:14:01 -06:00
Makefile working on build system (#39) 2016-10-21 10:20:11 -06:00
README.md cleaning up build system (#38) 2016-10-21 10:14:48 -06:00
test.sh working on build system (#39) 2016-10-21 10:20:11 -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 binary, 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.