Fork me on GitHub
#xtdb
<
2023-12-26
>
Sam16:12:40

Just trying out XQTL. How do I do where in? Like this, but working:

(q '(-> (from :recipes [recipe/name recipe/tags])
        (where (some #(= "foo") recipe/tags))
        (return recipe/name)))

jarohen21:12:33

Hey @UM7566XGS 👋 thanks for giving XTQL a try! We're planning to include a specific in? function, something like (where (in? "foo" recipe/tags)) - for now, as @U44P1CP5K says, unnest should be your friend:

'(-> (unify (from :recipes [recipe/name recipe/tags])
            (unnest {tag recipe/tags})
            (where (= tag "foo")))
     (return recipe/name)) 

jarohen21:12:23

we could potentially also support full unification in unnest, too, so eventually we should be able to cut out the where

'(-> (unify (from :recipes [recipe/name recipe/tags])
            (unnest {"foo" recipe/tags}))
     (return recipe/name))

👍 1
Sam21:12:25

Great, thank you so much! ❤️

hairfire16:12:08

I'm not sure what recipe/tags looks like, but my first guess is to consider using the "unnest" operator (See https://docs.xtdb.com/reference/main/xtql/queries#_unnest)

👌 1
❤️ 1
lgessler22:12:18

hi all! apologies if this has been answered before, but has there been any comment on the long-term plans for xtdb v1? v2 looks terrific and i'd like to migrate a project of mine to it, but i don't expect it'll be trivial due to the tx function changes, so i'm wondering how long i could expect to be able to linger on 1.x

seancorfield22:12:53

The message I've generally seen from the XTDB team is that v1 is going to be around for a good, long while, and it'll continue to get patches/security updates. But they will also be providing migration tools at some point. Probably also worth mentioning that v2 being production ready is probably quite some time away yet so v1 is still the choice for production needs for now.

👍 2
1
lgessler23:12:47

ah i didn't realize v2 was not stable yet. well, that's good news for me, then. thanks for the response 🙂