gouline/dbt-metabase

model sync fails - default target instead of actual schema name is used

geoHeil opened this issue · 2 comments

I am using a custom naming strategy like:

{% macro generate_schema_name(custom_schema_name, node) -%}
  {%- set default_schema = target.schema -%}
  {%- if target.schema == 'foo_schema' -%}
    {%- if custom_schema_name is none -%}

            {{ default_schema }}
            {{ log("Setting Default Schema: {0}".format(target.schema)) }}

        {%- else -%}

            {{ custom_schema_name | trim }}
            {{ log("Setting custom Schema: {0}".format(custom_schema_name)) }}

        {%- endif -%}

  {%- else -%}
  
    {%- if custom_schema_name is none -%}

            {{ target.schema }}

        {%- else -%}

            {{ target.schema }}

        {%- endif -%}
  {%- endif -%}
{%- endmacro %}

The schema of the dbt run profile is also set to foo_schema.

The table in question (which is reported missing by dbt-metabase) as:

WARNING  Model schema_b.mytable not found in schema_b schema                                                                                                                metabase.py:270

is actually created by dbt into the right schema:

07:33:06  1 of 26 START sql view model schema_b.mytable  [RUN]

To me it looks like the parsing of the manifest.json fails and dbt-metabase is looking for the mytable in foo_schema.mytable and not in schema_b.mytable.

Notice: the mytable is materialized as a view only - not as a table. I.e.:

select * from schema_b.mytable;

totally works just fine

Can dbt-metabase somewhere log more details?
This seems quite strange. What could be going wrong?

I think this might be a permission error - let me continue to debug

indeed - was a permission error