-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lisätty logiikka raw-taulujen luomiseen
- Loading branch information
Matz Rasmus
committed
Dec 11, 2024
1 parent
7d05650
commit bc58dc7
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% macro create_raw_tables() -%} | ||
|
||
{% set query %} | ||
SELECT raw_taulu from {{ ref('raw_taulut') }} | ||
{% endset %} | ||
|
||
{% set tables = run_query(query) %} | ||
|
||
{%set tables_list = tables.columns[0].values() %} | ||
|
||
{% if execute %} | ||
{% for table in tables_list %} | ||
{% set create_statement = 'create table if not exists raw.' + table +' ( | ||
"data" json NULL, | ||
dw_metadata_source_timestamp_at timestamptz NULL, | ||
dw_metadata_dbt_copied_at timestamptz NULL, | ||
dw_metadata_filename varchar NULL, | ||
dw_metadata_file_row_number int4 NULL | ||
); | ||
CREATE INDEX if not exists ix_'+ table + ' ON raw.' + table+ ' USING btree (dw_metadata_dbt_copied_at);' | ||
%} | ||
{{ print ( create_statement )}} | ||
{% do run_query(create_statement) %} | ||
{% endfor %} | ||
|
||
{% endif %} | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
|
||
seeds: | ||
- name: raw_taulut | ||
config: | ||
schema: raw | ||
description: | | ||
Tässä tiedostossa on lista kaikista raw-taulusta joita järjestelmässä on. Lisätääksesi uuden raw-taulun | ||
1) Lisää taulun nimi seeds/raw_taulut.csv-tiedostoon omalle riville | ||
2) aja # dbt seed --target=prod | ||
3) aja # dbt run-operation create_raw_tables --target=prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
raw_taulu | ||
ataru_hakemus | ||
ataru_lomake | ||
hakukohderyhmapalvelu_ryhma | ||
koodisto_koodi | ||
koodisto_relaatio | ||
kouta_ammattinimike | ||
kouta_asiasana | ||
kouta_haku | ||
kouta_hakukohde | ||
kouta_koulutus | ||
kouta_oppilaitoksetjaosat | ||
kouta_pistehistoria | ||
kouta_sorakuvaus | ||
kouta_toteutus | ||
kouta_valintaperuste | ||
ohjausparametrit_parameter | ||
onr_henkilo | ||
onr_yhteystieto | ||
organisaatio_organisaatio | ||
organisaatio_organisaatiosuhde | ||
organisaatio_osoite | ||
organisaatio_ryhma | ||
sure_arvosana | ||
sure_ensikertalainen | ||
sure_harkinnanvaraisuus | ||
sure_opiskelija | ||
sure_opiskeluoikeus | ||
sure_proxysuoritus | ||
sure_suoritus | ||
valintalaskenta_valintakoe_osallistuminen | ||
valintalaskenta_valintalaskennan_tulos | ||
valintaperusteet_hakukohde | ||
valintapiste_service_pistetieto | ||
valintarekisteri_hyvaksyttyjulkaistuhakutoive | ||
valintarekisteri_ilmoittautuminen | ||
valintarekisteri_jonosija | ||
valintarekisteri_lukuvuosimaksu | ||
valintarekisteri_valinnantulos | ||
valintarekisteri_valintatapajono | ||
valintarekisteri_vastaanotto |