# Utils for Snowflake User-Defined Functions (UDFs)

This module is used for any [PDP-related Snowflake user-defined functions (UDFs)](https://docs.snowflake.com/en/developer-guide/udf/udf-overview). While Snowflake offers an approach to use staged python code for UDFs, PP team opted to reduce complexity of infrastructure work (S3 bucket, IAM Policies and Roles, Snowflake Integration and grants, Jenkins deployment) in favor of using UDFs created with [in-line python](https://docs.snowflake.com/en/developer-guide/udf/python/udf-python-introduction#example), via PRs to the (database repo)[https://www.github.com/theorchard/database].

In order to reduce some risk of bad code, each UDF's python should be added to this directory, along with unit tests.

The deployment process for any new or updated UDFs should be:

1. Create a PR in this repo to:
* Add or update python code in this directory.
* Add or update unit tests corresponding to the code

2. Create a PR in the `database` repo to:
* `CREATE OR REPLACE FUNCTION`, and copy-paste the python code.

