Receiving the following error message while running the compare_relations macro within the audit-helper package:
“Error while parsing node: inline_query Macro get_filtered_columns_in_relation expected a Relation but received the value: None”
The context of why I’m trying to do this
I’ve refactored a legacy model based on dbt best practices and attempting to compare the legacy model to the refactored model as part of the auditing process. I’m relying on the dbt-audit-helper package to do this and the compare_relations macro in particular to accomplish.
What I’ve already tried
I’ve researched other posts and the following post seems to be related to my issue:
If you scroll down, you’ll notice @pempey offers a suggestion: " if I wrapped my jina in and {% if execute %} block it resolved my problem."
@jcampion then confirms that resolved here issue: “Wrapping the audit_helper function in the {% if execute %} block solved it. Thanks so much.”
However, I’m not sure how to apply this (aka wrap audit_helper function in the {% if execute %} block) as it relates to my code (below). If someone can provide details/advise on what that looks like, I can give a shot.
Some example code or error messages
Here is my code that is throwing the error referenced above.
{# in dbt Develop #}
{% set old_etl_relation=adapter.get_relation(
database=target.database,
schema="analytics",
identifier="type_2_user_signups"
) -%}
{% set dbt_relation=ref('fct_type_2_user_signups') %}
{{ audit_helper.compare_relations(
a_relation=old_etl_relation,
b_relation=dbt_relation,
exclude_columns=["loaded_at"],
primary_key="visitors_mduid"
) }}
Just as an FYI, “analytics” is the name of the schema within BigQuery, “type_2_user_signups” is the name of the legacy model/query in that schema and “fct_type_2_user_signups” is the name of the refactored model/query in that schema.
I gave that a shot and the good news is I’m not receiving the error message anymore but I’m also not receiving any results. Please find a screenshot attached.
I initially tried compiling as you recommended and it threw an error message similar to the original referenced above. I then noticed I was attempting to run on my Production schema (“analytics”) instead of my Development schema and questioned if that could be the culprit. After switching, compiling no longer threw an error message and previewing actually worked (screenshot below). I’m not sure if that’s exactly what resolved it but wanted to share in case helpful to someone else.
Really appreciate all your help in working through this Judy.