#partiql

bin+lib partiql-rs

A implementation of PartiQL

3 unstable releases

0.202106.4 Jun 10, 2021
0.202106.3 Jun 8, 2021
0.202105.8 May 23, 2021

#128 in Database interfaces

MIT and maybe LGPL-3.0-or-later

450KB
3K SLoC

PartiQL-rs

WIP

What's PartiQL?

pq command

pq samples/pokemon.json -q "$(cat<<EOF
SELECT
  no AS id,
  name,
  weight/height/height AS bmi
ORDER BY bmi DESC
LIMIT 10
EOF
)" -t csv
curl -s https://api.github.com/users/fuyutarow/repos | pq -q "$(cat<<EOS
SELECT
  owner.login AS user,
  stargazers_count AS star,
  svn_url AS url,
EOS
)" -t yaml

Installation

brew install fuyutarow/tap/pq

Sample Usage

Convert JSON <--> TOML <--> YAML <--> ...

Support

  • JSON
  • JSON5
  • TOML
  • YAML
  • XML
env | jo | pq
env | jo | pq -t yaml
env | jo | pq -t yaml | pq -t toml

sort keys of objects on output

env | jo | pq -S ;:
FYI
  • jo is a useful tool for creating json objects.
    brew install jo
    

Convert data

env | jo | pq "SELECT NAME AS name, USER AS user"

ip command is only available in Linux and WSL, not in Mac.

ip -j -p | pq "$(cat<<EOS
SELECT
  address,
  info.family AS inet,
  info.local
FROM addr_info AS info
WHERE inet LIKE 'inet%'
EOS
)"
  • SELECT
  • FROM
  • LEFT JOIN
  • WHERE
  • LIKE
  • ORDER BY
  • LIMIT

more examples

For Development

Requirements

Preparation

makers install-dev

build

makers build
makers build:pq ;: for pq commnad

test

makers test:lib
makers test:pq ;: for pq commnad

Dependencies

~9–13MB
~264K SLoC