Anil
03/08/2024, 5:06 AMInternal Error
popped ['materialization'], expected macro.elementary.test_python
Any resolution for this?Erik Zaadi
03/11/2024, 9:29 AMAnil
03/11/2024, 9:58 AM- elementary.python:
code_macro: mean_test
And in the macros folder I have added the sample test as:
{% macro mean_test(args) %}
import pandas as pd
def test(model_df, ref, session):
original_table = model_df.toPandas()
return True
{% endmacro %}
Anything I am doing wrong here?Erik Zaadi
03/11/2024, 12:17 PMAnil
03/11/2024, 12:20 PMAnil
03/11/2024, 12:23 PM- elementary.python:
code_macro: mean_test
Any other configuration I need to do to run python custom test? Normal elementary volume and anomaly tests are working fine.Erik Zaadi
03/11/2024, 12:25 PMversion:2
models:
- name: orders
description: This table has basic information about orders, as well as some derived facts based on payments
config:
tags: ["finance"]
elementary:
timestamp_column: "order_date"
tests:
- elementary.python:
tags: [anil_test]
code_macro: compare_tables
macro_args:
other_table: raw_orders
and:
{% macro compare_tables(args) %}
# in macros/test_for_anil.sql
def test(model_df, ref, session):
return 0
{% endmacro %}
Then I run it with:
dbt test -s 'tag:anil_test'Anil
03/11/2024, 4:54 PMAnil
03/12/2024, 5:55 AMErik Zaadi
03/13/2024, 6:33 AMAnil
03/13/2024, 6:35 AMAnil
03/13/2024, 6:38 AMInternal Error
popped ['materialization'], expected macro.elementary.test_pythonErik Zaadi
03/13/2024, 7:33 AMAnil
03/13/2024, 12:10 PMAnil
03/14/2024, 4:56 AMAnil
03/14/2024, 3:06 PMOfek Weiss
03/21/2024, 10:22 AMdbt allows for python code execution, the exception itself cannot be retrieved and displayed in the command output, so you would need to check it in your data warehouse.Anil
03/21/2024, 12:40 PM{% macro mean_test_(args) %}
def test(model_df, ref, session):
return True
{% endmacro %}
I think is is not able to find the macro itself. I place it in the macros of whole project, do I need to put in macros of elementary package?Ofek Weiss
03/21/2024, 2:49 PMbool is supported, only int (number of failing rows) or DataFrame (failing rows). can you try to change it to return 0?
also, can you share how your test is configured in the yml file?Anil
03/21/2024, 8:11 PMOfek Weiss
03/24/2024, 7:57 AM