{{
    config(
        alias='dim_countries',
        materialized="incremental",
        incremental_strategy="merge",
        unique_key = "country_guid",
    )
}}post_hook  = [
    "{% if not is_incremental() %}
          create unique clustered index ix_u_cl_{{ this.name }}_country_guid on {{ this }} (country_guid);
      {% endif %}"
    ]
{{
    config(
        alias='dim_countries',
        schema='1c_erp',
        materialized="incremental",
        incremental_strategy="merge",
        unique_key = "country_guid",
        post_hook=[
            "{% if not is_incremental() %}
            create unique clustered index ix_u_cl_{{ this.name }}_country_guid on {{ this }} (country_guid);
            {% endif %}",
        ],
    )
}}
select
  country_guid,
  coalesce(country_id,'Не задано') as country_id,
  coalesce(country_name,'Не задано') as country_name
from {{ ref('stg_1C_ERP_reference_countries') }}