From 9585c6a81687d897ecd9c48791f6dd6b273db55d Mon Sep 17 00:00:00 2001 From: Matz Rasmus Date: Wed, 27 Nov 2024 10:57:42 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Lis=C3=A4tty=20organisaatiorakenteeseen=20p?= =?UTF-8?q?arent=5Foid=3Dchild=5Foid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../int_organisaatio_rakenne.sql | 18 ++++++++++++++---- .../pub/pub_dim_organisaatio_rakenne.sql | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) 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_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 From 1f17c5ffa923b1f15f61bc77978dfd9491206b49 Mon Sep 17 00:00:00 2001 From: Matz Rasmus Date: Wed, 27 Nov 2024 10:58:01 +0200 Subject: [PATCH 2/2] =?UTF-8?q?lis=C3=A4tty=20sorttaus=20pub-tauluihuin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbt/models/pub/pub_dim_hakukohde.sql | 1 + dbt/models/pub/pub_dim_hakutoive.sql | 1 + dbt/models/pub/pub_fct_hakemus.sql | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) 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_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