dbt fails to create schema in bigquery after 1.5 upgrade

Hi!
I’m upgrading dbt from 1.2.1 to 1.5.0 and I am having issues building my models.
The adapter we use is bigquery (also updated the adapter) and we use a macro to build the different schemas we need.
After the update when I do a build or run command the macro is failing with the following error:

Compilation Error
  macro 'dbt_macro__create_schema' takes no keyword argument 'relation'

This is the macro that finds and calls the bigquery create schema macro:

{%- macro create_schema(schema, environment, pull_request, salt, description, expiration=1) -%}
    {{ return(adapter.dispatch('create_schema')(schema, environment, pull_request, salt, description, expiration)) }}
{%- endmacro -%}

This is the macro for creating a schema in bigquery:

{%- macro bigquery__create_schema(schema, environment, pull_request, salt, description, expiration) -%}
    {%- do log("[\33[34mEXECUTION\33[0m] Creating schema " ~ schema, info = true) -%}
    {%- if description is none -%}
        {%- set description = "na" -%}
    {%- endif -%}
    {%- set ddl -%}
         CREATE SCHEMA IF NOT EXISTS `{{ schema }}`
         OPTIONS (
            description = "{{ description }}",
            location = "us",
            default_table_expiration_days = {{ expiration }},
            labels = [
                ("environment" , "{{ environment }}"),
                ("pull-request" , "{{ pull_request }}"),
                ("salt" , "{{ salt }}")
            ]
        )
    {%- endset -%}
    {%- do run_query(ddl) -%}
    {%- do log("[\033[32mSUCCESS\33[0m] Schema created", info = true) -%}
{%- endmacro -%}

As you can see from the macros, no keyword argument ‘relation’ si needed so I don’t understand why it’s saying I’m passing that keyword.

Any help is appreciated.

For anyone having this same error while upgrading dbt, the solution for me was to change the names of the queries (both of them, the one doing the create schema as well as the one making the dispatch call).
My theory is that create_schema is now a reserved name and when making the call to it, dbt ran a different macro that took a relation argument and that’s why it failed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.