GithubHelp home page GithubHelp logo

Discussion: rq query language about rq HOT 12 OPEN

dflemstr avatar dflemstr commented on June 11, 2024 8
Discussion: rq query language

from rq.

Comments (12)

crides avatar crides commented on June 11, 2024 9

Hi, your project looks very interesting. I found this while looking for a alternative to jq, and also looking for a better syntax for rush. Since rq looks very similar to jq feature wise, my suggestions would be to base the overall syntax on jq's. This should make it easier for people to (hopefully) switch from jq to rq. These are some of the important parts:

  1. Indexing arrays/dictionaries shouldn't have its own command/process. Having jq-like indexing means you can have more flexibility;
  2. Invoking/calling commands/processes without parentheses is a good idea. This should improve ergonomics while using it in the shell, and also get rid of the weird semicolon argument separator in jq;
  3. Lambda/anonymous functions are a new thing in rq. When I took a look at the old examples, I find some of the lambdas would've been useless in jq because of the . (dot) input, although in some other cases I can also see why lambdas would be useful. I saw that the old lambda syntax is based on JS's. That should be fine with most people, although expression grouping for the body of the lambda should be done with () instead of {} (unlike the first example here).

Edit: If rq would be available as a library with a query language that would make it very easy to revive rush, which should be a very useful tool.

Edit 2: If anyone wants to try out rush but find the original is too outdated, here is my fork with minimal changes just to make it compile and work.

from rq.

PsychoLlama avatar PsychoLlama commented on June 11, 2024 7

Pardon me if this has been asked before, but does rq really need a query language? I've been using this purely as a format conversion tool and it's kind of awesome. I can import a yaml file and query it with jq, easily test MessagePack APIs by converting from plain JSON (and interpret responses), run CSV tools against JSON with xsv, and if it supported TSV output, then even datamash could join the fun.

Point is, rq is immensely useful even without a query language. Why not focus on conversions and offload data manipulation to more specialized tools?

from rq.

gabriel-fallen avatar gabriel-fallen commented on June 11, 2024 6

With jq I personally don't like some "shugary" aspects of the query language like square bracket surrounding for array creation:

jq '[.[] | {message: .commit.message, name: .commit.committer.name}]'

I'd prefer more linear "functional" pipeline akin to

jq '.[] | {message: .commit.message, name: .commit.committer.name} | :into []'

Another consideration is more functionality to work with table data. I would love to see for a query language at least something like Nu shell and at best something like Q. 😃

from rq.

johantiden avatar johantiden commented on June 11, 2024 3

@johantiden on the "success" and "how small" GNU utils are you might find https://danluu.com/cli-complexity/ quite amusing. wink

Nice one! Thanks for sharing!
Amusing and depressing at the same time.

from rq.

AndydeCleyre avatar AndydeCleyre commented on June 11, 2024 3

I'm an outsider here, as I only discovered this project while it's still considering a next query language, but think it's worth mentioning two different and IMO quite good structured data access and manipulation tools and corresponding syntaxes:

from rq.

gabriel-fallen avatar gabriel-fallen commented on June 11, 2024 2

@johantiden on the "success" and "how small" GNU utils are you might find https://danluu.com/cli-complexity/ quite amusing. 😉

from rq.

crides avatar crides commented on June 11, 2024

So just to be clear, this tool cannot be currently used to make queries?

Yes, if you're using the 1.0 version. You can still use pre 1.0 if you want.

Also, is it right that the previous query used JavaScript? If so why didnt it use Rust like the rest of the code?

Yes. I believe it's because it makes it easier for the users to customize the functionalities without digging into Rust code. But I need confirmation from @dflemstr .

Finally, if this tool cant query then why does it say "Record Query" here:

As you said, rq currently cannot be used to make queries. Personally I don't think it's a good idea to release a 1.0 version with the core functionalities ripped out, while the new direction (this issue) is not settled as it causes confusion. But this is the author's choice, and he probably has a good reason for it.

Note: I'm also new here, just trying to help when possible.

from rq.

gabriel-fallen avatar gabriel-fallen commented on June 11, 2024

Another JSON query language. Rather verbose and SQL-like but still has nice features worth considering, IMO.

from rq.

XVilka avatar XVilka commented on June 11, 2024

@gabriel-fallen the Operon link is dead.

from rq.

gabriel-fallen avatar gabriel-fallen commented on June 11, 2024

@XVilka but the Operon itself is evidently not. 😃 Thanks for the heads-up, I've updated the comment.

from rq.

johantiden avatar johantiden commented on June 11, 2024

Great point! Even though I stumbled upon rq while searching for an alternative to jq for queries. I guess that could be a separate project though!

The longevity and success of GNU projects in the past have been how small they can stay. Do one thing and do it really well! It will be easier to take over ownership (or keep maintaining) if the scope is as small as possible.

from rq.

cdupont avatar cdupont commented on June 11, 2024

Hello,
I came here while looking for a tool to query/modify CBOR data. It could be very useful for CBOR, as there is no tool to manipulate this kind of data right now. At the moment, I need to convert my data to JSON, manipulate it with jq, and convert is back. However this is complex, especially because JSON does not support well binary formats.

from rq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.