Releases: neilotoole/sq
v0.34.0
This release significantly overhauls sq
's config mechanism (#199).
For an overview, see the new config docs.
Alas, this release has several minor breaking changes ☢️.
Added
sq config ls
shows config.sq config get
gets individual config option.sq config set
sets config values.sq config edit
edits config.- Editor can be specified via
$EDITOR
or$SQ_EDITOR
.
- Editor can be specified via
sq config location
prints the location of the config dir.--config
flag is now honored globally.- Many more knobs are exposed in config.
- Logging is much more configurable. There are new knobs:
There are also equivalent flags (
$ sq config set log true $ sq config set log.level INFO $ sq config set log.file /var/log/sq.log
--log
,--log.file
and--log.level
) and
envars (SQ_LOG
,SQ_LOG_FILE
andSQ_LOG_LEVEL
). - Several more commands support YAML output:
Changed
- The structure of
sq
's config file (sq.yml
) has changed. The config
file is automatically upgraded when using the new version. - The default location of the
sq
log file has changed. The new location
is platform-dependent. Usesq config get log.file -v
to view the location,
orsq config set log.file /path/to/sq.log
to set it. - ☢️ Envar
SQ_CONFIG
replacesSQ_CONFIGDIR
. - ☢️ Envar
SQ_LOG_FILE
replacesSQ_LOGFILE
. - ☢️ Format flag
--table
is renamed to--text
. This is changed because while the
output is mostly in table format, sometimes it's just plain text. Thus
table
was not quite accurate. - ☢️ The flag to explicitly specify a driver when piping input to
sq
has been
renamed from--driver
to--ingest.driver
. This change aligns
the naming of the ingest options and reduces ambiguity.# previously $ cat mystery.data | sq --driver=csv '.data' # now $ cat mystery.data | sq --ingest.driver=csv '.data'
- ☢️
sq add
no longer has the generic--opts x=y
mechanism. This flag was
ambiguous and confusing. Instead, use explicit option flags.# previously $ sq add ./actor.csv --opts=header=false # now $ sq add ./actor.csv --ingest.header=false
- ☢️ The short form of the
sq add --handle
flag has been changed from-h
to
-n
. While this is not ideal, the-h
shorthand is already in use everywhere
else as the short form of--header
.# previously $ sq add ./actor.csv -h @actor # now $ sq add ./actor.csv -n @actor
- ☢️ The
--pretty
flag has been removed. Its only previous use was with the
json
format, where if--pretty=false
would output the JSON in compact form.
To better align with jq, there is now a--compact
/-c
flag that behaves
identically tojq
. - ☢️ Because of the above
--compact
/-c
flag, the short form of the--csv
flag is changing from-c
to-C
. It's an unfortunate situation, but alignment
with jq's behavior is an overarching principle that justifies the change.
v0.33.0
The headline feature is source groups.
This is the biggest change to the sq
CLI in some time, and should make working with lots of sources much easier.
Added
- #192:
sq
now has a mechanism to group sources. A source handle can
now be scoped. For example, instead of@sakila_prod
,@sakila_staging
, etc,
you can use@prod/sakila
,@staging/sakila
. Usesq group prod
to
set the active group (whichsq ls
respects). See docs. sq group GROUP
sets the active group toGROUP
.sq group
returns the active group (default is/
, the root group).sq ls GROUP
lists the sources inGROUP
.sq ls --group
(orsq ls -g
) lists all groups.sq mv
moves/renames sources and groups.
Changed
sq ls
now shows the active item in a distinct color. It no longer adds
an asterisk to the active item.sq ls
now sorts alphabetically when using--table
format.sq ls
now shows the sources in the active group only. But note that
the default active group is/
(the root group), so the default behavior
ofsq ls
is the same as before.sq add hello.csv
will now generate the handle@hello
instead of@hello_csv
.
On a second invocation, it will return@hello1
instead of@hello_csv_1
. Why
this change? Well, with the availability of the source group mechanism, the_
character
in the handle somehow looked ugly. And more importantly,_
is a relative pain to type.sq ping
has changed to support groups. Instead ofsq ping --all
, you can
dosq ping GROUP
, e.g.sq ping /
.
v0.32.0
Added
-
#187: For
csv
sources,sq
will now try to auto-detect if the CSV file
has a header row or not. Previously, this needed to be explicitly specified
via an awkward syntax:$ sq add ./actor.csv --opts=header=true
This change makes working with CSV files significantly lower friction.
A command like the below now almost always works as expected:$ cat ./actor.csv | sq .data
Support for Excel/XLSX header detection is in #191.
Fixed
-
sq
is now better at detecting the (data) kind of CSV fields. It now more
accurately distinguishes betweenDecimal
andInt
, and knows how to
handleDatetime
. -
#189:
sq
now treats CSV empty fields asNULL
.
v0.31.0
v0.30.0
Added
- #164: Implemented
unique
function (docs):This is equivalent to:$ sq '.actor | .first_name | unique'
SELECT DISTINCT first_name FROM actor
- Implemented
count_unique
function (docs).$ sq '.actor | count_unique(.first_name)'
Changed
- The
count
function has been changed (docs)- Added no-args version:
.actor | count
equivalent toSELECT COUNT(*) AS "count" FROM "actor"
. - BREAKING CHANGE: The "star" version (
.actor | count(*)
) is no longer supported; use the
naked version instead.
- Added no-args version:
- Function columns are now named according to the
sq
token, not the SQL token.# previous behavior $ sq '.actor | max(.actor_id)' max("actor_id") 200 # now $ sq '.actor | max(.actor_id)' max(.actor_id) 200
v0.29.0
Added
- #162:
group_by
now accepts function arguments.
Changed
- Renamed
groupby
togroup_by
to match jq. - Renamed
orderby
toorder_by
to match jq.
v0.28.0
Added
- #160: Use
groupby()
to group results. See query guide.
v0.27.0
Added
- #158: Use
orderby()
to order results. See query guide.