ANN: LightQuery

Hey, so this is actually a pretty cool one. If you’re an author of a query-like package, chances are, you only will need a few method wrappers to make your package compatible with LightQuery. Then, users can use LightQuery to easily mix and match various backends. Here’s an example. First, make the wrappers.

using LightQuery: @query

import DataFramesMeta: AbstractDataFrame, where
where(d::AbstractDataFrame, f_tuple::Tuple{Function, Expr}) = where(d, f_tuple[1])

import QueryOperators: Enumerable, orderby, query
orderby(source::Enumerable, f_tuple::Tuple{Function, Expr}) = orderby(source, f_tuple...)

Now mix and match!

julia> @query DataFrame(a = [0, 1, 2], b = [2, 1, 0]) |>
           where1(_, _.a .> 0) |>
           query(_) |>
           orderby1(_, _.b)
2x2 query result
a │ b
──┼──
2 │ 0
1 │ 1
3 Likes

Please let me know (open an issue) if you’d like help adding LightQuery compatibility methods to your package. I’d feel rude tagging query package authors but I’m hoping they’ll see this.

Version 0.1 is up. Take a look!