James Guthrie
jamesguthrie.bsky.social
James Guthrie
@jamesguthrie.bsky.social
computers, coding, networking, rust

software engineer in AI at Timescale

🇿🇦 in 🇨🇭
Nice, looking forward to this!
December 25, 2024 at 4:24 PM
Do it!
December 22, 2024 at 5:01 PM
I know the operator soup is somewhat reminiscent of line noise, but the power!
December 10, 2024 at 7:40 AM
Combine that magic into:

UPDATE <table>
SET <jsonb_column> = <jsonb_column> #- '{"path", "to", "delete"}'
WHERE <jsonb_column> @? '$.path.to.delete';

🤯
December 10, 2024 at 7:40 AM
`@?` returns if a jsonpath is in an object:

> SELECT '{"foo": {"bar": "baz"}}'::jsonb @? '$.foo.bar' as "@?";
@?
----
t
December 10, 2024 at 7:38 AM
`#-` deletes a field specified by a path:

> SELECT '{"foo": {"bar": "baz"}}'::jsonb #- '{"foo", "bar"}' as "#-";

#-
-------------
{"foo": {}}
December 10, 2024 at 7:37 AM
Hey, I do Rust stuff!
November 13, 2024 at 12:08 AM
Seems like you found it? Maybe the real question is how to reproduce it?

Did it help that you were writing for a specific person (as opposed to a broader audience)?
November 10, 2024 at 8:25 PM