Releases: neilotoole/sq
Releases Β· neilotoole/sq
v0.38.1
v0.38.0
This release has significant improvements (and breaking changes) to SLQ (sq
's query language).
Changed
-
β’οΈ #254: The formerly-implicit "WHERE" mechanism now requires an explicit
where()
function.
This, alas, is a fairly big breaking change. But it's necessary to remove an ambiguity roadblock.
See discussion in the issue.# Previously $ sq '.actor | .actor_id <= 2' # Now $ sq '.actor | where(.actor_id <= 2)'
-
#256: Column-only queries are now possible. This has the neat side effect
thatsq
can now be used as a calculator.$ sq 1+2 1+2 3
You may want to use
--no-header
(-H
) when usingsq
as a calculator.$ sq -H 1+2 3 $ sq -H '(1+2)*3' 9
Fixed
-
Literals can now be selected (docs).
$ sq '.actor | .first_name, "X":middle_name, .last_name | .[0:2]' first_name middle_name last_name PENELOPE X GUINESS NICK X WAHLBERG
-
Lots of expressions that previously failed badly, now work.
$ sq '.actor | .first_name, (1+2):addition | .[0:2]' first_name addition PENELOPE 3 NICK 3
-
#258: Column aliases can now be arbitrary strings, instead of only a
valid identifier.# Previously only valid identifier allowed $ sq '.actor | .first_name:given_name | .[0:2]' given_name PENELOPE NICK # Now, any arbitrary string can be used $ sq '.actor | .first_name:"Given Name" | .[0:2]' Given Name PENELOPE NICK
v0.37.1
v0.37.0
v0.36.2
Changed
- β’οΈ Proprietary database functions are now invoked by prefixing the function name with an underscore. For example:
# mysql "date_format" func
$ sq '@sakila/mysql | .payment | _date_format(.payment_date, "%m")'
# Postgres "date_trunc" func
$ sq '@sakila/postgres | .payment | _date_trunc("month", .payment_date)'
v0.36.1
Fixed
sq diff
: Renamed--count
flag to--counts
as intended.
v0.36.0
The major feature is the long-gestating sq diff
.
Added
- #229:
sq diff
compares two sources, or tables. sq inspect --dbprops
is a new mode that returns only the DB properties.
Relatedly, the properties mechanism is now implemented for all four supported
DB types (previously, it was only implemented for Postgres and MySQL).- CSV format now colorizes output.
Changed
sq inspect -v
previously returned DB properties in a field nameddb_variables
.
This field has been renamed todb_properties
. The renaming reflects the fact
that some of those properties aren't really variables in the sense that they
can be modified (e.g. DB server version or such).- The structure of the former
db_variables
(nowdb_properties
) field has
changed. Previously it was an array of{"name": "XX", "value": "YY"}
values,
but now is a map, where the keys are strings, and the values can be either
a scalar (bool
,int
,string
, etc.), or a nested value such as an array
or map. This change is made because some databases (e.g. SQLite) feature
complex data in some property values. - CSV format now renders byte sequences as
[777 bytes]
instead of dumping
the raw bytes. - β’οΈ TSV format (
--tsv
) no longer has a shorthand form-T
. Apparently that
shorthand wasn't used much, and-T
is needed elsewhere. - β’οΈ Likewise,
--xml
no longer has shorthand-X
. And--markdown
has lost alias--md
. - In addition to the format flags
--text
,--json
, etc., there is now
a--format=FORMAT
flag, e.g.--format=json
. This will allowsq
to
continue to expand the number of output formats, without needing to have
a dedicated flag for each format.
v0.35.0
v0.34.2
Fixed
- Both
--markdown
and the alias--md
are now supported.
v0.34.1
Fixed
- Fixed a minor issue where
sq ls -jv
andsq ls -yv
produced no output
if config contained no explicitly set options.