Enable Model Materialization as User Defined Function#302
Open
rfeith2 wants to merge 7 commits into
Open
Conversation
…tion-in-dremio-dbt Add UDF materialization
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
Creates the ability to define the materialization type of a model as a user defined function in Dremio
Description
This PR introduces a new built-in udf materialization type for dbt-dremio that allows users to create user-defined functions (UDFs) directly from dbt models, addressing a key limitation where UDFs created as macros don't appear in the dependency graph (DAG).
Problem Statement:
Solution:
This implementation provides native UDF materialization support, ensuring UDFs are properly tracked in dbt's dependency graph and appear in data lineage visualizations.
Core Implementation:
Key Features:
Usage Example:
{{ config(
materialized='udf',
parameter_list='start_date DATE, end_date DATE',
returns='TABLE(order_id INT, customer_name VARCHAR)'
) }}
RETURN
SELECT order_id, customer_name
FROM orders
WHERE order_date BETWEEN start_date AND end_date
Migration from Custom Implementation:
Users can now remove their custom UDF materialization macros and use this built-in implementation, gaining improved validation, error handling, and consistency with dbt-dremio conventions.
Test Results
Functional Tests (tests/functional/adapter/materialization/test_udf.py):
Unit Tests (tests/unit/test_udf_materialization.py):
Hook Tests (tests/functional/adapter/materialization/test_udf_hooks.py):
Changelog
Contributor License Agreement
Related Issue
N/A