diff --git a/dbt/models/int/int_yleiskayttoiset/int_organisaatio_rakenne.sql b/dbt/models/int/int_yleiskayttoiset/int_organisaatio_rakenne.sql index 7c10f83..894ee9e 100644 --- a/dbt/models/int/int_yleiskayttoiset/int_organisaatio_rakenne.sql +++ b/dbt/models/int/int_yleiskayttoiset/int_organisaatio_rakenne.sql @@ -24,9 +24,19 @@ org (parent_oid, child_oid) as ( org2.organisaatio_oid as child_oid from organisaatio as org2 inner join org as orga on orga.child_oid = org2.ylempi_organisaatio +), + +final as ( + select + parent_oid, + child_oid + from org + union + select + organisaatio_oid as parent_oid, + organisaatio_oid as child_oid + from organisaatio ) -select - parent_oid, - child_oid -from org +select * from final + diff --git a/dbt/models/pub/pub_dim_hakukohde.sql b/dbt/models/pub/pub_dim_hakukohde.sql index 6bc45b7..e79b104 100644 --- a/dbt/models/pub/pub_dim_hakukohde.sql +++ b/dbt/models/pub/pub_dim_hakukohde.sql @@ -119,3 +119,4 @@ final as ( ) select * from final +order by haku_oid \ No newline at end of file diff --git a/dbt/models/pub/pub_dim_hakutoive.sql b/dbt/models/pub/pub_dim_hakutoive.sql index 8ff8efd..6b93f1d 100644 --- a/dbt/models/pub/pub_dim_hakutoive.sql +++ b/dbt/models/pub/pub_dim_hakutoive.sql @@ -53,3 +53,4 @@ final as ( ) select * from final +order by haku_oid \ No newline at end of file diff --git a/dbt/models/pub/pub_dim_organisaatio_rakenne.sql b/dbt/models/pub/pub_dim_organisaatio_rakenne.sql index b922a36..2b206b0 100644 --- a/dbt/models/pub/pub_dim_organisaatio_rakenne.sql +++ b/dbt/models/pub/pub_dim_organisaatio_rakenne.sql @@ -14,4 +14,5 @@ with source as ( select parent_oid, child_oid -from source \ No newline at end of file +from source +order by 1,2 \ No newline at end of file diff --git a/dbt/models/pub/pub_fct_hakemus.sql b/dbt/models/pub/pub_fct_hakemus.sql index 06feaa3..18966ab 100644 --- a/dbt/models/pub/pub_fct_hakemus.sql +++ b/dbt/models/pub/pub_fct_hakemus.sql @@ -1,6 +1,9 @@ {{ config( - materialized = 'table' + materialized = 'table', + indexes = [ + {'columns':['haku_oid']} + ] ) }} @@ -23,3 +26,4 @@ int as ( ) select * from int +order by haku_oid