Snowflake’s support for Jinja now includes imports – this means you can modularise your code, and use macros.
Your challenge is to create two scripts:
utils.sql
:
Will contain a macro called power_of_two
that meets the following requirements:
- Accepts a list of numbers
- For each number, returns:
- The original number
- The squared (two the power of two) number
- Unions all
main.sql
:
Will be the file that simply calls the macro – it should use a simple list of `[1, 2, 3, 4]`
If all is correct, you ought to get a result like:
Happy Jinjaing!