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

Implement WHERE for PRINT #123

Open
tbm opened this issue Dec 19, 2022 · 2 comments
Open

Implement WHERE for PRINT #123

tbm opened this issue Dec 19, 2022 · 2 comments
Labels
enhancement New feature or request feature New feature

Comments

@tbm
Copy link
Contributor

tbm commented Dec 19, 2022

It seems like print only supports from. What do you think of adding where to print and how hard would it be?

Ledger allows this and this is a great feature - seeing the original transaction only for certain queries.

One use case: when I import txns from PayPal for a non-profit, I check for donations larger than a certain amount because I want to look more closely (is it really an unsolicited donation or some kind of sponsorship/receivable) , e.g. SELECT * WHERE ACCOUNT ~ 'Income:Donations' AND number < -100, but when I want to look at the whole transaction to see all the meta-data and stuff and so a PRINT with this WHERE query would be really useful.

@dnicolodi
Copy link
Collaborator

It is not difficult to add support for the WHERE clause to PRINT. However, PRINT is implicitly a query on the transactions table, thus the WHERE clause can be applied only to fields available in transactions table, not from the postings table.

I would like to bring the semantics of PRINT closer to standard SQL, maybe transforming it in a form of SELECT that implicitly selects a query rendering format of type beancount, but there are many transformation of the beanquery internals that are required to get there, and I don't have a clear path defined yet.

Once that is done, one way to solve this is to have another form of the PRINT statement that looks something like this:

PRINT entry FROM #postings WHERE account ~ 'Income:Donations' AND number < -100

@dnicolodi dnicolodi added the enhancement New feature or request label Jul 25, 2023
@tbm
Copy link
Contributor Author

tbm commented Aug 2, 2023

Thanks for your explanation. That sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants