github neilotoole/sq v0.38.0

latest releases: v0.48.3, v0.48.2, v0.48.1...
15 months ago

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
    that sq can now be used as a calculator.

    $ sq 1+2
    1+2
    3

    You may want to use --no-header (-H) when using sq 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

Don't miss a new sq release

NewReleases is sending notifications on new releases.