remove tracking_product_shares
This commit is contained in:
		
							parent
							
								
									250f61873c
								
							
						
					
					
						commit
						a3b4501fa9
					
				| 
						 | 
					@ -1,22 +0,0 @@
 | 
				
			||||||
{{ config(
 | 
					 | 
				
			||||||
    indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
 | 
					 | 
				
			||||||
    unique_key = '_airbyte_ab_id',
 | 
					 | 
				
			||||||
    schema = "_airbyte_unibag",
 | 
					 | 
				
			||||||
    tags = [ "top-level-intermediate" ]
 | 
					 | 
				
			||||||
) }}
 | 
					 | 
				
			||||||
-- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
 | 
					 | 
				
			||||||
-- depends_on: {{ source('unibag', '_airbyte_raw_tracking_product_shares') }}
 | 
					 | 
				
			||||||
select
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['_id'], ['_id']) }} as _id,
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['user'], ['user']) }} as {{ adapter.quote('user') }},
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['source'], ['source']) }} as {{ adapter.quote('source') }},
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['options'], ['options']) }} as {{ adapter.quote('options') }},
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['products'], ['products']) }} as products,
 | 
					 | 
				
			||||||
    {{ json_extract_scalar('_airbyte_data', ['createdAt'], ['createdAt']) }} as createdat,
 | 
					 | 
				
			||||||
    _airbyte_ab_id,
 | 
					 | 
				
			||||||
    _airbyte_emitted_at,
 | 
					 | 
				
			||||||
    {{ current_timestamp() }} as _airbyte_normalized_at
 | 
					 | 
				
			||||||
from {{ source('unibag', '_airbyte_raw_tracking_product_shares') }} as table_alias
 | 
					 | 
				
			||||||
-- tracking_product_shares
 | 
					 | 
				
			||||||
where 1 = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,22 +0,0 @@
 | 
				
			||||||
{{ config(
 | 
					 | 
				
			||||||
    indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
 | 
					 | 
				
			||||||
    unique_key = '_airbyte_ab_id',
 | 
					 | 
				
			||||||
    schema = "_airbyte_unibag",
 | 
					 | 
				
			||||||
    tags = [ "top-level-intermediate" ]
 | 
					 | 
				
			||||||
) }}
 | 
					 | 
				
			||||||
-- SQL model to cast each column to its adequate SQL type converted from the JSON schema type
 | 
					 | 
				
			||||||
-- depends_on: {{ ref('tracking_product_shares_ab1') }}
 | 
					 | 
				
			||||||
select
 | 
					 | 
				
			||||||
    cast(_id as {{ dbt_utils.type_string() }}) as _id,
 | 
					 | 
				
			||||||
    cast({{ adapter.quote('user') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('user') }},
 | 
					 | 
				
			||||||
    cast({{ adapter.quote('source') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('source') }},
 | 
					 | 
				
			||||||
    cast({{ adapter.quote('options') }} as {{ dbt_utils.type_string() }}) as {{ adapter.quote('options') }},
 | 
					 | 
				
			||||||
    cast(products as {{ dbt_utils.type_string() }}) as products,
 | 
					 | 
				
			||||||
    cast(createdat as {{ dbt_utils.type_string() }}) as createdat,
 | 
					 | 
				
			||||||
    _airbyte_ab_id,
 | 
					 | 
				
			||||||
    _airbyte_emitted_at,
 | 
					 | 
				
			||||||
    {{ current_timestamp() }} as _airbyte_normalized_at
 | 
					 | 
				
			||||||
from {{ ref('tracking_product_shares_ab1') }}
 | 
					 | 
				
			||||||
-- tracking_product_shares
 | 
					 | 
				
			||||||
where 1 = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,22 +0,0 @@
 | 
				
			||||||
{{ config(
 | 
					 | 
				
			||||||
    indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
 | 
					 | 
				
			||||||
    unique_key = '_airbyte_ab_id',
 | 
					 | 
				
			||||||
    schema = "_airbyte_unibag",
 | 
					 | 
				
			||||||
    tags = [ "top-level-intermediate" ]
 | 
					 | 
				
			||||||
) }}
 | 
					 | 
				
			||||||
-- SQL model to build a hash column based on the values of this record
 | 
					 | 
				
			||||||
-- depends_on: {{ ref('tracking_product_shares_ab2') }}
 | 
					 | 
				
			||||||
select
 | 
					 | 
				
			||||||
    {{ dbt_utils.surrogate_key([
 | 
					 | 
				
			||||||
        '_id',
 | 
					 | 
				
			||||||
        adapter.quote('user'),
 | 
					 | 
				
			||||||
        adapter.quote('source'),
 | 
					 | 
				
			||||||
        adapter.quote('options'),
 | 
					 | 
				
			||||||
        'products',
 | 
					 | 
				
			||||||
        'createdat',
 | 
					 | 
				
			||||||
    ]) }} as _airbyte_tracking_product_shares_hashid,
 | 
					 | 
				
			||||||
    tmp.*
 | 
					 | 
				
			||||||
from {{ ref('tracking_product_shares_ab2') }} tmp
 | 
					 | 
				
			||||||
-- tracking_product_shares
 | 
					 | 
				
			||||||
where 1 = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,23 +0,0 @@
 | 
				
			||||||
{{ config(
 | 
					 | 
				
			||||||
    indexes = [{'columns':['_airbyte_emitted_at'],'type':'btree'}],
 | 
					 | 
				
			||||||
    unique_key = '_airbyte_ab_id',
 | 
					 | 
				
			||||||
    schema = "unibag",
 | 
					 | 
				
			||||||
    tags = [ "top-level" ]
 | 
					 | 
				
			||||||
) }}
 | 
					 | 
				
			||||||
-- Final base SQL model
 | 
					 | 
				
			||||||
-- depends_on: {{ ref('tracking_product_shares_ab3') }}
 | 
					 | 
				
			||||||
select
 | 
					 | 
				
			||||||
    _id,
 | 
					 | 
				
			||||||
    {{ adapter.quote('source') }},
 | 
					 | 
				
			||||||
    {{ adapter.quote('user') }} AS seller_id,
 | 
					 | 
				
			||||||
    products AS product_id,
 | 
					 | 
				
			||||||
    {{ adapter.quote('options') }}::json->>'action' AS options_action,
 | 
					 | 
				
			||||||
    createdat::timestamp AS created_at,
 | 
					 | 
				
			||||||
    _airbyte_ab_id,
 | 
					 | 
				
			||||||
    _airbyte_emitted_at,
 | 
					 | 
				
			||||||
    {{ current_timestamp() }} as _airbyte_normalized_at,
 | 
					 | 
				
			||||||
    _airbyte_tracking_product_shares_hashid
 | 
					 | 
				
			||||||
from {{ ref('tracking_product_shares_ab3') }}
 | 
					 | 
				
			||||||
-- tracking_product_shares from {{ source('unibag', '_airbyte_raw_tracking_product_shares') }}
 | 
					 | 
				
			||||||
where 1 = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue