Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added quality-of-life feature to make model_type lookup case-insensitive in the model_audit macro #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion macros/hooks/model_audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,24 @@ onnx: {}

{% endmacro %}

{% macro _get_model_type(ml_config) %}

{%- set ns = namespace(model_type=none) %}
{%- if ml_config %}
{%- for key, value in ml_config.items() %}
{%- if key.lower() == 'model_type' %}
{%- set ns.model_type = value | string | lower %}
{%- endif %}
{%- endfor %}
{%- endif %}
{% do return(ns.model_type) %}

{% endmacro %}

{% macro model_audit() %}

{% set model_type = config.get('ml_config')['model_type'].lower() if config.get('ml_config')['model_type'] else None %}
{%- set ml_config = config.get('ml_config', {}) -%}
{% set model_type = dbt_ml._get_model_type(ml_config) %}
{% set model_type_repr = model_type if model_type in dbt_ml._audit_insert_templates().keys() else 'default' %}

{% set info_types = ['training_info', 'feature_info', 'weights', 'evaluate'] %}
Expand Down