feat: add UDF function resource support and adapter tests for dbt-core v1.11#763
Open
axellpadilla wants to merge 2 commits into
Open
feat: add UDF function resource support and adapter tests for dbt-core v1.11#763axellpadilla wants to merge 2 commits into
axellpadilla wants to merge 2 commits into
Conversation
This was
linked to
issues
Jul 24, 2026
Open
axellpadilla
force-pushed
the
feat/add-function-resource-tests
branch
from
July 24, 2026 22:47
f1db251 to
6f7964b
Compare
axellpadilla
force-pushed
the
feat/add-function-resource-tests
branch
from
July 24, 2026 22:51
6f7964b to
52fa00e
Compare
axellpadilla
force-pushed
the
feat/add-function-resource-tests
branch
from
July 24, 2026 23:15
52fa00e to
727ec57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds UDF (user-defined function) resource support and adapter tests for dbt-core v1.11's new function resource type (issue #761, part of #719).
Changes
Function = "function"toSQLServerRelationTypeenumNew:
dbt/include/sqlserver/macros/materializations/functions/scalar.sqlSQL Server-specific scalar UDF macros:
sqlserver__scalar_function_sql— main entry pointsqlserver__scalar_function_create_replace_signature_sql— usesCREATE OR ALTER FUNCTIONwith 2-part names (SQL Server forbids database prefix)sqlserver__formatted_scalar_function_args_sql—@param typesyntax with default value supportsqlserver__scalar_function_body_sql—BEGIN RETURN ... ENDsqlserver__scalar_function_volatility_sql— no-op (SQL Server has no volatility keywords)sqlserver__unsupported_volatility_warning— warns when volatility is setNew:
dbt/include/sqlserver/macros/materializations/functions/helpers.sqlsqlserver__function_execute_build_sql— runsUSE [db]in a separate batch beforeCREATE FUNCTION(required becauseCREATE FUNCTIONmust be the first statement in a batch)New:
tests/functional/adapter/dbt/test_functions.py15 test classes (13 active, 2 skipped for UDAFs):
TestUDFsBasic— scalar UDF build + executeTestDeterministicUDF,TestStableUDF,TestNonDeterministicUDF— volatility warningsTestErrorForUnsupportedType—type: tablefails gracefullyTestPythonUDFNotSupported— Python UDFs fail gracefullyTestSqlUDFDefaultArgSupport— default parameter valuesTestUDFParse—dbt parsewithfunctions/TestUDFList—dbt list --select resource_type:functionTestUDFBuild—dbt build --select resource_type:functionTestUDFModelRef— model using{{ function('name') }}TestUDFSchemaCreation— schema created before functionTestUDFRebuild— function rebuild viaCREATE OR ALTERTestBasicSQLUDAF,TestBasicPythonUDAF— skipped (SQL Server doesn't support aggregate functions)SQL Server-Specific Adaptations
USE [db]in separate batch, then 2-part nameUSEbatch viafunction_execute_build_sqloverride@prefixformatted_scalar_function_args_sql= valuesyntaxformatted_scalar_function_args_sqlBEGIN...ENDscalar_function_body_sqlDEFAULTkeywordfunc(DEFAULT)notfunc()Testing
All 13 active tests pass against a live SQL Server instance. 2 UDAF tests skipped with explicit reason.