Kissaki, (edited )

While it doesn’t provide an SQL interface, I’ve been using Nushell as my shell, which has native data operations.

I tried querying the same, and I’m still not fluent (this was my third or fourth bigger/practical data querying), but it works well and fast too when you know the syntax:


<span style="color:#323232;">http get https://api.github.com/orgs/golang/repos | each {|x| get license} | get key | group-by --to-table | update items {|x| $x.items | length }
</span>

I’ve used Nushell for reading en-mass json files, generating command json files for stuff saved in excel files (you can natively open those too), and most recently to query log files for specific information and usage analysis.

/edit: This comment has the better nu solution.

bugsmith,
@bugsmith@programming.dev avatar

Love this. Always interesting to see novel ways of querying data in the terminal, and I agree that jq’s syntax is difficult to remember.

I actually prefer nu(shell) for this though. On the lobste.rs thread for this blog, a user shared this:


<span style="color:#323232;">| get license.key -i
</span><span style="color:#323232;">| uniq --count
</span><span style="color:#323232;">| rename license
</span><span style="color:#323232;">
</span><span style="color:#323232;">This outputs the following:
</span><span style="color:#323232;">
</span><span style="color:#323232;">╭───┬──────────────┬───────╮
</span><span style="color:#323232;">│ # │    license   │ count │
</span><span style="color:#323232;">├───┼──────────────┼───────┤
</span><span style="color:#323232;">│ 0 │ bsd-3-clause │    23 │
</span><span style="color:#323232;">│ 1 │ apache-2.0   │     5 │
</span><span style="color:#323232;">│ 2 │              │     2 │
</span><span style="color:#323232;">╰───┴──────────────┴───────╯
</span><span style="color:#323232;">
</span>
Kissaki,

Haha, I tried querying in Nushell before reading this and I was sure there was a better way. And indeed there is (especially since I was missing uniq). I’m still learning the available operators, but I enjoy the shell a lot, as well as its promised capabilities.

bugsmith,
@bugsmith@programming.dev avatar

I really like Nushell. I would not run it as a daily driver currently, as it mostly doesn’t win me over from Fish, feature-wise, but I love having it available for anything CLI date pipeline work I need to do.

LPThinker,

I’ll stick with nushell for terminal-first data interactions.

magic_lobster_party,

I use jq almost every day, and I can admit its syntax is a bit cumbersome. Will give this a try.

bobburger,

I love DuckDB. It's really nice to be able to put a bunch of parquet files in a directory and then do operations on them as if they were a sql database. You can even put an index on the files if you're feeling froggy.

LinearArray,
@LinearArray@programming.dev avatar

Interesting

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming@programming.dev
  • rosin
  • thenastyranch
  • ethstaker
  • osvaldo12
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • ngwrru68w68
  • slotface
  • GTA5RPClips
  • kavyap
  • cubers
  • JUstTest
  • everett
  • cisconetworking
  • tacticalgear
  • anitta
  • khanakhh
  • normalnudes
  • Durango
  • modclub
  • tester
  • provamag3
  • Leos
  • megavids
  • lostlight
  • All magazines