Skip to content

fix: Version Snowflake materialization UDFs instead of replacing them - #7232

Draft
daniel-kristjansson wants to merge 3 commits into
feast-dev:masterfrom
daniel-kristjansson:fix/versioned-snowflake-udfs
Draft

daniel-kristjansson wants to merge 3 commits into
feast-dev:masterfrom
daniel-kristjansson:fix/versioned-snowflake-udfs

Conversation

@daniel-kristjansson

@daniel-kristjansson daniel-kristjansson commented Nov 24, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

In production we don't want services to be able to modify UDFs that are already deployed. The UDFs run inside every materialization, so they should change only through a deliberate deployment, not as a side effect of whichever service last ran feast apply or materialized.

#6608 works against that: every feast apply redeploys the Snowflake materialization UDFs with CREATE OR REPLACE FUNCTION. As a result:

  • Every service needs ownership of the UDFs. Replacing or dropping a function requires owning it, so the role running Feast must be allowed to rewrite deployed code. Schemas that lock this down (for example, with future-ownership grants that hand new objects to a separate role) make feast apply fail.
  • Any Feast version can overwrite the UDFs for every other one. All Feast versions sharing a schema run whichever UDFs were applied last, so one service upgrading Feast silently changes the code that other services materialize with.

This PR makes deployed UDFs immutable by content-addressing them:

  • UDFs are named feast_<project>_<fingerprint>_*. The 8-character fingerprint hashes the packaged Feast source files, the UDF creation SQL template and python_udf_runtime_version. The zip is uploaded to <stage>/<project>_<fingerprint>/.
  • The functions are created with CREATE FUNCTION IF NOT EXISTS and never replaced. A change to python_udf_runtime_version (the case fix: Bump decommissioned Snowflake Python UDF runtime from 3.9 to 3.10 (#6606) #6608 fixed) still takes effect, because it produces a new fingerprint and deploys a new set alongside the old one.
  • update() restores an existence check (SHOW USER FUNCTIONS) and returns early when the current set already exists. Once the UDFs are deployed, services that apply or materialize need no CREATE, WRITE or ownership privileges on them.
  • Materialization runs the idempotent deployment once per engine, so a new Feast version works before anyone runs feast apply.
  • Teardown also drops the seven snowflake_array_*_proto UDFs that the deletion SQL was missing. If the UDFs can't be dropped (for example, because the role doesn't own them), it warns instead of raising, so the rest of the teardown, such as deleting the registry, still runs.

Which issue(s) this PR fixes:

Follow-up to #6608.

Misc

🤖 Generated with Claude Code


Devin Review

feast-dev#6608 made every `feast apply` redeploy the materialization UDFs with
CREATE OR REPLACE FUNCTION. Replacing (or dropping) a function requires
owning it, which fails in schemas whose future-ownership grants hand new
objects to another role, and every Feast version sharing a schema runs
whichever UDFs were applied last.

UDFs are now named `feast_<project>_<fingerprint>_*`, where the
fingerprint hashes the packaged Feast source, the creation SQL template
and python_udf_runtime_version, and their zip is uploaded to
`<stage>/<project>_<fingerprint>/`. They are created with CREATE FUNCTION
IF NOT EXISTS and never replaced. A runtime-version change still takes
effect, because it deploys a new set.

update() checks with SHOW USER FUNCTIONS and returns early when the
current set exists, so materializing needs no CREATE or WRITE
privileges once the UDFs are deployed. Materialization runs the
idempotent deployment once per engine, so a new Feast version works
before anyone runs `feast apply`.

Teardown now also drops the seven snowflake_array_*_proto UDFs it was
missing, and warns instead of raising when the UDFs cannot be dropped,
so the rest of the teardown (e.g. registry deletion) still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Daniel Kristjansson <danielk@cuymedia.net>
@daniel-kristjansson
daniel-kristjansson requested a review from a team as a code owner November 24, 2026 18:35

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

4 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@daniel-kristjansson
daniel-kristjansson marked this pull request as draft November 24, 2026 18:56
daniel-kristjansson and others added 2 commits November 24, 2026 13:58
…E pattern

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Daniel Kristjansson <danielk@cuymedia.net>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Daniel Kristjansson <danielk@cuymedia.net>
@daniel-kristjansson
daniel-kristjansson force-pushed the fix/versioned-snowflake-udfs branch from b810198 to ef209c9 Compare November 24, 2026 19:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant