# \#udf

**URL:** https://discourse.getdbt.com/tag/udf/33.md

[Latest](https://discourse.getdbt.com/latest.md) · [Categories](https://discourse.getdbt.com/categories.md) · [Tags](https://discourse.getdbt.com/tags.md)

---

## [BigQuery JS UDF (nanoid) returns same value many times only when run via dbt incremental MERGE](https://discourse.getdbt.com/t/bigquery-js-udf-nanoid-returns-same-value-many-times-only-when-run-via-dbt-incremental-merge/20566)

<div class="topic-metadata">

**Author:** [@jirick](https://discourse.getdbt.com/u/jirick)\
**Replies:** 0\
**Last updated:** [January 29, 2026, 7:23pm UTC](https://discourse.getdbt.com/t/bigquery-js-udf-nanoid-returns-same-value-many-times-only-when-run-via-dbt-incremental-merge/20566 "2026-01-29T19:23:20Z")

</div>

The problem I’m having I’m using a BigQuery JavaScript UDF (NanoID) to generate unique IDs in dbt models. For ~2 years it worked fine, but recently (starting around Oct 2024) some dbt runs produce the same generated ID r…

---

## [Using dbt to manage user defined functions](https://discourse.getdbt.com/t/using-dbt-to-manage-user-defined-functions/18)

<div class="topic-metadata">

**Author:** [@claire](https://discourse.getdbt.com/u/claire)\
**Replies:** 24\
**Last updated:** [February 9, 2025, 5:00pm UTC](https://discourse.getdbt.com/t/using-dbt-to-manage-user-defined-functions/18 "2025-02-09T17:00:31Z")

</div>

Note: This post uses Redshift SQL, however the same concept applies to most data warehouses. Check out the notes on BigQuery in the comments below. Our dbt project uses some user defined functions (UDFs). In the past, …

---

## [Postgres UDF Materialization](https://discourse.getdbt.com/t/postgres-udf-materialization/13851)

<div class="topic-metadata">

**Author:** [@acama23](https://discourse.getdbt.com/u/acama23)\
**Replies:** 0\
**Last updated:** [June 17, 2024, 5:25pm UTC](https://discourse.getdbt.com/t/postgres-udf-materialization/13851 "2024-06-17T17:25:30Z")

</div>

Problem I’m able to create a new materialization for setting my UDFs in Postgres. The code compiles and runs as it should and there are no errors. However, when I check the database for the newly created UDF, it doesn’t …

---

## [Use a UDF to do a dynamic rollup by date](https://discourse.getdbt.com/t/use-a-udf-to-do-a-dynamic-rollup-by-date/7905)

<div class="topic-metadata">

**Author:** [@claires](https://discourse.getdbt.com/u/claires)\
**Replies:** 9\
**Last updated:** [April 26, 2023, 6:26am UTC](https://discourse.getdbt.com/t/use-a-udf-to-do-a-dynamic-rollup-by-date/7905 "2023-04-26T06:26:42Z")

</div>

I know this post is super-dead, but I am at wits’ end and this is the only discussion of using macros to create UDFs that I’ve found. I need to do a dynamic rollup by date, and I don’t want to create a model that precom…

---

## [How to specify target schema for udfs?](https://discourse.getdbt.com/t/how-to-specify-target-schema-for-udfs/1294)

<div class="topic-metadata">

**Author:** [@alex\_unsw](https://discourse.getdbt.com/u/alex_unsw)\
**Replies:** 1\
**Last updated:** [June 26, 2020, 1:30am UTC](https://discourse.getdbt.com/t/how-to-specify-target-schema-for-udfs/1294 "2020-06-26T01:30:17Z")

</div>

Hi all, I started implementing the approach illustrated in this post for BigQuery. -- macros/udfs/file\_name.sql {% set schema = 'schema\_name' %} {% macro macro\_name() %} CREATE OR REPLACE FUNCTION {{target.schema}}.fu…

---

## [How to Create a Series of Python UDFs for Parsing User Agents in Redshift](https://discourse.getdbt.com/t/how-to-create-a-series-of-python-udfs-for-parsing-user-agents-in-redshift/159)

<div class="topic-metadata">

**Author:** [@abelsonlive](https://discourse.getdbt.com/u/abelsonlive)\
**Replies:** 0\
**Last updated:** [November 9, 2018, 10:06pm UTC](https://discourse.getdbt.com/t/how-to-create-a-series-of-python-udfs-for-parsing-user-agents-in-redshift/159 "2018-11-09T22:06:50Z")

</div>

What follows is a step-by-step guide to creating a series of Python UDFs on Redshift for parsing user agents with Python’s user-agents module. While our ultimate goal will be efficiently parsing user agents in Redshift, …
