prql
prql copied to clipboard
Where does documentation for `module` stand?
What's up?
I have a set of functions that I would like to include in each of my PRQL query files. I can't make it work.
I attempted to paste one of the definitions of a module from the Modules page into the Playground, but got this error message:
explicit module declarations are not allowed
I also tried simply adding module my_module_file.prql
to the beginning of another query in an attempt to import the definitions, but no dice.
What else do I need to know? :-) Many thanks.
Update: This is the set of function declarations I use in several queries... If I'm understanding modules correctly, I could create the file once and simply "name it" in each query...
# dollars displays a numeric value as dollars with commas
let dollars = d -> s"""printf('$%,d',{d})"""
# pct computes the amount (percent) the new differs from old
let pct = o n -> 100.0*( n - o ) / o
# prtpct prints a floating point number with "%"
let prtpct = v -> s"printf('%1.1f%'', {v})"