Query.jl @groupby How to specify the key selector properly?

Hello, I wonder what is the proper way to use the @groupby function from Query.jl when the key selector is a variable of type Symbol?

Example:

using DataFrames, Query
df = DataFrame(name=["John", "Sally", "Kirk"], age=[23., 42., 59.], children=[3,2,2])

x = df |> @groupby(_.children) |> collect
x

This gives

2-element Array{Grouping{Int64,NamedTuple{(:name, :age, :children),Tuple{String,Float64,Int64}}},1}:
 [(name = "John", age = 23.0, children = 3)]
 [(name = "Sally", age = 42.0, children = 2), (name = "Kirk", age = 59.0, children = 2)]

which is what I need. On the other hand, if I do

varname = Symbol("children")
y = df |> @groupby(varname) |> collect

Then I get

1-element Array{Grouping{Any,NamedTuple{(:name, :age, :children),Tuple{String,Float64,Int64}}},1}:
 [(name = "John", age = 23.0, children = 3), (name = "Sally", age = 42.0, children = 2), (name = "Kirk", age = 59.0, children = 2)]

which is different from above.

So what’s the proper way to use groupby if I’m writing a function that takes the input varname?

This post looks related, but does not have a solution either.

Continuing the discussion from Using a string variable in a Query.jl query.