Create a model to truncate and load into DBT models

The problem I’m having

I am trying to read and load the BIgqiuery table using dbt models and trunctate and load every time

What I’ve already tried

Some example code or error messages

{{
  config(
    pre_hook={
      "sql": "SQL-statement",
      "transaction": False
    },
    post_hook={
      "sql": "SQL-statement",
      "transaction": False
    }
  )
}}

{{
  config(
    pre_hook={
      "sql": "SQL-statement",
      "transaction": False
    },
    post_hook={
      "sql": "SQL-statement",
      "transaction": False
    }
  )
}}

1 Like

Did you solve this?

I am new to dbt and I was trying to find a solution for this:

We create table and column description, labels, elsewhere.

The default table materialisation will recreate the table every time and metadata will be lost.

{{ config(
materialized=‘incremental’,
pre_hook={
“sql”: “truncate table your_table;”,
“transaction”: False
}) }}