Invalid Filter Reference
I'm getting an
Ash.Error.Query.InvalidFilterReference
I'm trying to push a particular filter into the DB level. I have this calculation, which works:
But when I try to use this in a filter expr(...)
on its parent relationship (a scan has many issues), I get an invalid filter reference error:
The specific error is:
:target
is just a simple string attribute.
Is it not possible to do what I'm trying to do?
Halp?12 Replies
Hm...it doesn't really make sense to have a calculation with a parent reference in it right then because parent is set by the context the calculation is used in
Can you try inlining it instead of using a calculation? Does that work?
On the scan
unapproved_node_issues
relationship?
If I put this on scan
, it does not work:
But also, I wouldn't expect it to because parent
now refers to the scan
... so I'm not sure how to compare basically a list of the site's approved node_issues
against the scan's node_issues
via an expr
I would prefer this 2nd version to the first if I could just figure out the syntax
Assuming it's possibleOh, sorry I misunderstood
Um...so that calculation works on its own but not in that relationship?
it does, yeah
Strange. Are you fully up to date?
Ash_postgres and ash_sql etc
3.5.39
Hrm
I don't know what the latest versions are off the top of my head 🙂
But if that's the latest then good 😂
Yeah I was pretty up to date and still get that error on the latest versions
I can try to make a repro later if that would help?
It would indeed 🙂
Oh snap! I'm using AshCloak on that field so instead of
target
I have to use encrypted_target
Tests still aren't passing but I'm not getting that error anymore.
Creating a repro can be so clarifying
So this is interesting.
In order to match against my encrypted field, I basically need to create another derived field from it. In this case I'm calling it hashed_target
and I'm just running the original target through sha256
encryption.
Claude tells me I could also use a cloak
cipher that is deterministic to allow for matching, but I'd rather not since that's weaker security and target
may actually contain PPI.
I'm half wondering if something like this could be added as an option to ash_cloak
?
As in would you theoretically be open to a PR on that front?
Goes a little somethin' like this. I only need to run this on :create
and for the one attribute but this is the gist.
Possibly open to it? Not sure would have to see what it looks like generic
The timestamp on that reply 😭
Anywho I'll see how it goes!