Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Option to write the keys used for the join #2407

Closed
datatraveller1 opened this issue Jan 3, 2025 · 3 comments · Fixed by #2408
Closed

Enhancement: Option to write the keys used for the join #2407

datatraveller1 opened this issue Jan 3, 2025 · 3 comments · Fixed by #2408
Labels
enhancement New feature or request. Once marked with this label, its in the backlog.

Comments

@datatraveller1
Copy link

I'd like to suggest a join and joinp option to write the keys used for a join to a file:
--keys-output <file> Write keys to <file>

e.g. if the join is:
qsv joinp --keys-output=keys.csv category,class file1.csv category,class file2.csv -o values.csv

then --keys-output=keys.csv would write the keys (category,class) for which the join was successfull to the file keys.csv.

I assume this could happen "for free" (without much additional coding), because these keys are used to build the join result.

@jqnatividad jqnatividad added the enhancement New feature or request. Once marked with this label, its in the backlog. label Jan 4, 2025
@jqnatividad
Copy link
Collaborator

Hi @datatraveller1 ,
That's a good idea.
I implemented it in join.

I can't implement it in joinp however, as qsv just builds the join definition using the Polars join_builder and hands it off to the Polars engine.

@datatraveller1
Copy link
Author

datatraveller1 commented Jan 4, 2025

Hi @jqnatividad Thank you very much. 👍
It's a pity that it doesn't work for joinp, but I can use something like the following commands instead:

qsv joinp category,class file1.csv category,class file2.csv -o values.csv
qsv dedup --select category,class values.csv | qsv select category,class -o keys.csv

@jqnatividad
Copy link
Collaborator

jqnatividad commented Jan 5, 2025

I was actually thinking of removing join right after I added --ignore-case to joinp.

But now, it's clear that they serve different use cases.

Speaking of which, I just added non-equi join support to joinp. 😄

#2409

And as to your "recipe", that's great! That's why one of qsv's goal is composability.

My hope is that over time, we build up a recipe library (mixing in other common CLI commands), preferably a large part of it from the community that can be readily shared and reused.

It will take time, but we're already seeding it with qsv pro...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. Once marked with this label, its in the backlog.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants