In duckdb, it is possible to reuse sql with Macros, and it is also possible to define table functions in Julia, using create_table_function.
Also scalar udf functions written in Julia can be used with duckdb (using @cfunction) but I’m not sure the scalar udf c api is documented in the client api. For example, the collatz example for the rhai extension can be implemented as a Julia function and then function can be registered in duckdb.