-
Notifications
You must be signed in to change notification settings - Fork 14
sources.beancount: Correct type for links and tags columns #242
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
base: master
Are you sure you want to change the base?
sources.beancount: Correct type for links and tags columns #242
Conversation
Currently, `[...] GROUP BY links` throws the following exception: beanquery.compiler.CompilationError: GROUP-BY a non-hashable type is not supported: "Column(name='links')" because `set` is not hashable. `frozenset` is hashable, and can be used for the `links` and `tags` which don't need to be mutable.
Thanks for working on this. I trusted the old type annotation in Beancount and deduced that these fields are returned as sets, not frozen sets. Newer Beancount has the right annotations. This should definitely be fixed, however, the proposed patch is not enough: there are other things that need to be adjusted to support frozen sets. The first that comes to mind is support to render columns with It is not strictly related to the PR itself, but if the added test case is an example of why you need this functionality, I think there is a better way of doing what you are doing:
with a query like:
|
Thanks! I'll update the PR and also add a new test for the rendering.
I agree, it feels a bit like a hack (I was surprised that grouping by links works in |
The problem of using links in this way is that it makes it impossible to use them for anything else as adding links to a transaction break the |
Good points, I'll consider it in the future. I added a |
Actually, you got me convinced. I just refactored my entire ledger (with autobean-refactor), and added a customized version of the Anyway, I think the PR is still valid, possibly there are other use cases for grouping by links or tags. |
Currently,
[...] GROUP BY links
throws the following exception:because
set
is not hashable.frozenset
is hashable, and can be used for thelinks
andtags
which don't need to be mutable.