Releases: neilotoole/sq
v0.48.11
Fixed
-
#502:
sq sqlnow properly executes single SQL statements (INSERT,UPDATE,
DROP, etc.) instead of incorrectly running them as queries.- This fixes broken behavior with strict database drivers and ensures affected
row counts are correctly reported. Note thatsq sqlis designed to accept
only a single SQL statement/query in the SQL input string; behavior is
undefined for multiple statements in the input. - Thanks to @drluckyspin for the fix.
- This fixes broken behavior with strict database drivers and ensures affected
-
#520:
sq addandsq lserroneously printed source password for SQL Server URLs
in some circumstances. -
#469: Column widths were too wide when using
--no-headerflag. Header text
is now excluded from column width calculation when headers are disabled.
Thanks to @majiayu000 for the fix.
v0.48.10
Fixed
- #506: Fixed two XLSX-related issues (sadly, both are regression fixes):
- Stdin detection: Fixed type detection failing for XLSX files created by
various tools (e.g., theexcelizelibrary). These files have varying internal
ZIP structures that the previous detection couldn't handle. Detection now
scans ZIP local file headers instead of relying on fragile magic number
heuristics. - Output colorization: Fixed XLSX binary output (
--xlsx) being corrupted
when written tostdout. The colorization decorator was modifying the binary
data. XLSX format now bypasses colorization, like--rawoutput already does.
- Stdin detection: Fixed type detection failing for XLSX files created by
Changed
-
#504: Updated
golangci-linttov2.7.2, along with Go dependencies
and GitHub Actions workflow versions. Other tool versions have been updated too.Note that Go tool dependencies are now located in the
tools/directory, each
with its owngo.mod. Tools are invoked viago tool -modfile, e.g.
go tool -modfile=tools/golangci-lint/go.mod golangci-lint.See the Makefile and
tools/README.mdfor more detail.
v0.48.9
v0.48.5
Fixed
-
#446: A
bufio.ErrTooLongwas being returned bybufio.Scanner, when splitting lines from input that was too long (larger thanbufio.MaxScanTokenSize, i.e.64KB). This meant thatsqwasn't able to parse large JSON files, amongst other problems. The maximum buffer size is now configurable via the newtuning.scan-buffer-limitoption. Note that the buffer will start small and grow as needed, up to the limit.$ sq config set tuning.scan-buffer-limit 64MB # or 1024B, 64KB, 1GB, etc.A more useful error message is also now returned when the buffer limit is exceeded (the error suggests adjusting
tuning.scan-buffer-limit).
Changed
- Renamed config option
tuning.buffer-mem-limittotuning.buffer-spill-limit. The new name better reflects the purpose of the option.
v0.48.4
Changed
- Updated Go dependencies (was failing some security vulnerability scans).
v0.48.3
Small bugfix release.
Fixed
- #415: The JSON ingester could fail due to a bug when a JSON blob landed on the edge of a buffer.
- The JSON ingester wasn't able to handle the case where a post-sampling JSON field had a different kind from the kind determined by the sampling process. For example, let's say the sample size was 1000, and the field
zipwas determined to be of kindint, because values 0-1000 were all parseable as integers. But then the 1001st value wasBX123, which obviously is not an integer.sqwill now see the non-integer value, and alter the ingest DB schema to a compatible kind, e.g.text. This flexibility is powerful, but it does come at the cost of slower ingest speed. But that's a topic for another release.
v0.48.1
This release features significant improvements to sq diff.
Added
-
Previously
sq diff --datadiffed every row, which could get crazy with a large table. Now the command stops after N differences, where N is controlled by the--stop(-n) flag, or the new config optiondiff.stop. The default stop-after value is3; set to0to show all differences.# Stop on first difference $ sq diff @prod.actor @staging.actor --data --stop 1 # Stop after 5 differences, using the -n shorthand flag $ sq diff @prod.actor @staging.actor --data -n5
-
#353: The performance of
sq diffhas been significantly improved. There's still more to do. -
Previously,
sq diff --datacompared the rendered (text) representation of each value. This could lead to inaccurate results, for example with two timestamp values in different time zones, but the text rendering omitted the time zone. Now,sq diff --datacompares the raw values, not the rendered text. Note in particular with time values that both time and location components are compared. -
sqcan now handle a SQLite DB onstdin. This is useful for testing, or for working with SQLite DBs in a pipeline.$ cat sakila.db | sq '.actor | .first_name, .last_name'
It's also surprisingly handy in daily life, because there are sneaky SQLite DBs all around us. Let's see how many text messages I've sent and received over the years:
$ cat ~/Library/Messages/chat.db | sq '.message | count' count 215439
I'm sure that number makes me an amateur with these millenials 👴🏻.
Note that you'll need to enable macOS Full Disk Access to read the
chat.dbfile. -
sqnow allows you to usetrueandfalseliterals in queries. Which, in hindsight, does seem like a bit of an oversight 😳. (Although previously you could usually get away with using1and0).$ sq '.people | where(.is_alive == false)' name is_alive Kubla Khan false $ sq '.people | where(.is_alive == true)' name is_alive Kaiser Soze true
Changed
-
☢️ Previously,
sq diffonly exited non-zero on an error. Now,sq diffexits0when no differences, exits1if differences are found, and exits2on any error. This aligns with the behavior of GNU diff:Exit status is 0 if inputs are the same, 1 if different, 2 if trouble. -
Minor fiddling with the color scheme for some command output.
v0.47.4
Patch release with changes to flags. See the earlier v0.47.0 release for recent headline features.
Added
-
By default,
sqprints source locations with the password redacted. This is a sensible default, but there are legitimate reasons to access the unredacted connection string. Thus a new global flag--no-redact(and a correspondingredactconfig option).# Default behavior: password is redacted $ sq src -v @sakila/pg12 postgres postgres://sakila:[email protected]/sakila # Unredacted $ sq src -v --no-redact @sakila/pg12 postgres postgres://sakila:[email protected]/sakila
-
Previously, if an error occurred when
verbosewas true, anderror.formatwastext,sqwould print a stack trace tostderr. This was poor default behavior, flooding the user terminal, so the default is now no stack trace. To restore the previous behavior, use the new-E(--error.stack) flag, or set theerror.stackconfig option.
Changed
-
The
--src.schemaflag (as used insq inspect,sq sql, and the rootsqcmd) now accepts--src.schema=CATALOG.. Note the.suffix onCATALOG.. This is in addition to the existing allowed formsSCHEMAandCATALOG.SCHEMA. This newCATALOG.form is effectively equivalent toCATALOG.CURRENT_SCHEMA.# Inspect using the default schema in the "sales" catalog $ sq inspect --src.schema=sales. -
The
--src.schemaflag is now validated. Previously, if you provided a non-existing catalog or schema value,sqwould silently ignore it and use the defaults. This could mislead the user into thinking that they were getting valid results from the non-existent catalog or schema. Now an error is returned.
v0.47.3
Minor bug fix release. See the earlier v0.47.0 release for recent headline features.
Fixed
- Shell completion for
bashonly worked for top-level commands, not for subcommands, flags, args, etc. This bug was due to an unnoticed behavior change in an imported library 🤦♂️. It's now fixed, and tests have been added.
Changed
- Shell completion now initially suggests only sources within the active group. Previously, all sources were suggested, potentially flooding the user with irrelevant suggestions. However, if the user continues to input a source handle that is outside the active group, completion will suggest all matching sources. This behavior is controlled via the new config option
shell-completion.group-filter.