Snippets Collections
{% snapshot mock_orders %}

{% set new_schema = target.schema + '_snapshot' %}

{{
    config(
        target_database='analytics',
        target_schema=new_schema,
        unique_key='order_id',

        strategy='timestamp',
        updated_at='updated_at'
    )
}}

select * from analytics.{{ target.schema }}.mock_orders

{% endsnapshot %}
{{ 
	config(
    	materialized="incremental",
    	unique_key="page_view_id" 			-- This line is the key to replace duplicates
    )
}}

with events as (
  
	select * from {{ source('schema', 'table') }}
	{% if is_incremental() %}
    	where collector_tstamp >= ( select dateadd('day', -3, max(max_collector_tstamp)) from {{ 		this }}
    {% endif %}
    
)
-- for table
{{
  config(
  	materialized="table" 
  )
}}

-- for view
{{
  config(
  	materialized="view" 
  )
}}

-- for ephemeral
{{
  config(
  	materialized="ephemeral"
  )
}}

-- for incremental
{{
  config(
  	materialized="incremental"
  )
}}
<div class="fixed-action-btn show-mobile-only">
  <a class="btn-floating btn-large light-green" title="Back to Top" onclick="scrolltoTop()" id="scrollBtn">
    <i class="material-icons">keyboard_arrow_up</i>
  </a>
</div>

<script>
  // When the user scrolls down 100px from the top of the document, show the button
  window.onscroll = function () { scrollFunction() };

  function scrollFunction() {
    if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
      document.getElementById("scrollBtn").style.display = "inline-block";
    } else {
      document.getElementById("scrollBtn").style.display = "none";
    }
  }

  // When the user clicks on the button, scroll to the top of the document
  function scrolltoTop() {
    document.body.scrollTop = 0; // For Safari
    document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
  }
</script>
star

Sat May 06 2023 15:30:45 GMT+0000 (Coordinated Universal Time)

#dbt #materialize
star

Sat May 06 2023 14:45:35 GMT+0000 (Coordinated Universal Time)

#dbt #incremental #materialize
star

Sat May 06 2023 07:13:28 GMT+0000 (Coordinated Universal Time) https://docs.getdbt.com/docs/build/materializations

#dbt #config #materialize
star

Sat Jun 27 2020 12:11:26 GMT+0000 (Coordinated Universal Time)

#html #javascript #materialize

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension