Custom materialization does not create an object without commit

The problem I’m having

Using dbt-greenplum adapter (dbt-greenplum · PyPI /)

I am learning to make my own materialization, I made such a simple materialization:

{%- materialization my_view, default -%}

    {%- set identifier = model.config.get('identifier') or none -%}
    {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database, type='view') -%}

    {{ run_hooks(pre_hooks, inside_transaction=false) }}

    {% call statement('main') -%}
        {{ log("Creating view: " ~ target_relation, info=True) }}
        {{ create_view_as(target_relation, sql) }}
        {{ log("View created successfully: " ~ target_relation, info=True) }}
    {%- endcall %}

    {{ run_hooks(post_hooks, inside_transaction=false) }}

    {{ return({'relations': [target_relation]}) }}

{%- endmaterialization -%}

After launching the model, dbt reports success in the log, however, the view does not appear in the database.
If I add the line
{%do adapter.commit()%}
, then the view appears.
However, as I know, it is not necessary to manage transactions in dbt inside the materialization.
What am I doing wrong?

Here is my model:

{{ config(
   identifier='a_test',
   schema='dwh_dds',
   database='dwh',
   materialized='my_view'
) }}

select *
from stg_tpch.supplier__ext
1 Like