mirror of
https://github.com/FlipsideCrypto/fsc-utils.git
synced 2026-02-06 10:56:49 +00:00
2.0 KiB
2.0 KiB
Flipside Utility Functions
Dbt repo for managing the Flipside Utility Functions (FSC_UTILS) dbt package.
Variables
To control the creation of UDF or SP macros with dbt run:
- UPDATE_UDFS_AND_SPS When True, executes all macros included in the on-run-start hooks within dbt_project.yml on model run as normal When False, none of the on-run-start macros are executed on model run
Default values are False
- Usage: dbt run --var 'UPDATE_UDFS_AND_SPS": True' -m ...
Dropping and creating udfs can also be done without running a model:
dbt run-operation create_udfs --var 'UPDATE_UDFS_AND_SPS": True' --args 'drop_:false'
dbt run-operation create_udfs --var 'UPDATE_UDFS_AND_SPS": True' --args 'drop_:true'
Adding the fsc_utils dbt package
The fsc_utils dbt package is a centralized repository consisting of various dbt macros and snowflake functions that can be utilized across other repos.
- Navigate to the
create_udfs.sqlmacro in your respective repo where you want to install the package. - Add the following:
{% set name %}
{{- fsc_utils.create_udfs() -}}
{% endset %}
{% do run_query(sql) %}
- Note: fsc_utils.create_udfs() takes two parameters (drop_=False, schema="utils"). Set
drop_toTrueto drop existing functions or defineschemafor the functions (default set toutils). Params not required. - Navigate to
packages.ymlin your respective repo. - Add the following:
- git: https://github.com/FlipsideCrypto/fsc-utils.git
- Run
dbt depsto install the package - Run the macro
dbt run-operation create_udfs --var '{"UPDATE_UDFS_AND_SPS":True}'
Resources
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices