Skip to content

CLI Reference

sqlquack function

Convert a SQL project function's body into a DuckDB macro body.

sqlquack function converts the body of a SQL function your project defines into the body of a DuckDB macro, and prints it as JSON.

sqlquack function --name <NAME> --schema <SCHEMA> [OPTIONS] <BODY>
sqlquack function --name NET_TOTAL --schema schema.json --builtin-policy net_total.sql

BODY is the file holding the function’s body: a scalar function’s expression, or a table function’s query. Use - to read standard input. The schema declares the function under functions, with its arguments and return type, and the relations its body reads. See Schema files.

A converted body prints the macro’s parameters and body. A refused body prints {"converted": false, "name": …, "refusals": [diagnostics]} instead, with the same diagnostics on standard error.

Option Meaning
--name <name> The function’s name, as the schema declares it. Required.
--schema <file> The schema declaring the function and the relations its body reads. Required.
--session NAME=VALUE A Snowflake session parameter of your session. Repeatable.

function also takes the policy flags.

0 when the body converts, 1 when it is refused, 2 when the command can’t run.