# Custom materialization does not create an object without commit

**URL:** <https://discourse.getdbt.com/t/custom-materialization-does-not-create-an-object-without-commit/12205>\
**Category:** Help\
**Created:** [February 26, 2024, 8:10pm UTC](https://discourse.getdbt.com/t/custom-materialization-does-not-create-an-object-without-commit/12205 "2024-02-26T20:10:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snejock](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Snejock](https://discourse.getdbt.com/u/Snejock)\
**Post date:** [February 26, 2024, 8:10pm UTC](https://discourse.getdbt.com/t/custom-materialization-does-not-create-an-object-without-commit/12205/1 "2024-02-26T20:10:20Z")

</div>

## The problem I’m having

Using dbt-greenplum adapter ([Client Challenge](https://pypi.org/project/dbt-greenplum) /)

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

```auto
{%- 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:

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

select *
from stg_tpch.supplier__ext

```
