From 5ff2aaa26ee82959f50d3b3fb56320e69a638d40 Mon Sep 17 00:00:00 2001 From: Lawrence Adams Date: Sun, 3 Nov 2024 18:56:29 +0000 Subject: [PATCH 1/2] fix: create empty source_to_concept_map model - used insted of seeding an empty csv file - enables use of 'BYOData' to the project with postgres/snowflake/etc --- models/omop/source_to_concept_map.sql | 12 +++++++++++- .../stg_vocabulary__source_to_concept_map.sql | 14 -------------- seeds/vocabulary/source_to_concept_map_seed.csv | 1 - 3 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 models/staging/vocabulary/stg_vocabulary__source_to_concept_map.sql delete mode 100644 seeds/vocabulary/source_to_concept_map_seed.csv diff --git a/models/omop/source_to_concept_map.sql b/models/omop/source_to_concept_map.sql index b01ec0c..fa78ab9 100644 --- a/models/omop/source_to_concept_map.sql +++ b/models/omop/source_to_concept_map.sql @@ -1 +1,11 @@ -SELECT * FROM {{ ref('stg_vocabulary__source_to_concept_map') }} +SELECT + cast(null AS int) AS source_code + , cast(null AS varchar) AS source_concept_id + , cast(null AS int) AS source_vocabulary_id + , cast(null AS varchar) AS source_code_description + , cast(null AS int) AS target_concept_id + , cast(null AS varchar) AS target_vocabulary_id + , cast(null AS date) AS valid_start_date + , cast(null AS date) AS valid_end_date + , cast(null AS varchar(1)) AS invalid_reason +WHERE false diff --git a/models/staging/vocabulary/stg_vocabulary__source_to_concept_map.sql b/models/staging/vocabulary/stg_vocabulary__source_to_concept_map.sql deleted file mode 100644 index 716cdb5..0000000 --- a/models/staging/vocabulary/stg_vocabulary__source_to_concept_map.sql +++ /dev/null @@ -1,14 +0,0 @@ -{% set column_names = - dbt_utils.get_filtered_columns_in_relation( source('vocabulary', 'source_to_concept_map') ) -%} - - -WITH cte_source_to_concept_map_lower AS ( - - SELECT - {{ lowercase_columns(column_names) }} - FROM {{ source('vocabulary','source_to_concept_map') }} -) - -SELECT * -FROM cte_source_to_concept_map_lower diff --git a/seeds/vocabulary/source_to_concept_map_seed.csv b/seeds/vocabulary/source_to_concept_map_seed.csv deleted file mode 100644 index 2178624..0000000 --- a/seeds/vocabulary/source_to_concept_map_seed.csv +++ /dev/null @@ -1 +0,0 @@ -source_code,source_concept_id,source_vocabulary_id,source_code_description,target_concept_id,target_vocabulary_id,valid_start_date,valid_end_date,invalid_reason \ No newline at end of file From e65d1f4f9139f7086c99e42d7c6c0eb706d68277 Mon Sep 17 00:00:00 2001 From: Lawrence Adams Date: Mon, 4 Nov 2024 07:50:48 +0000 Subject: [PATCH 2/2] fix: remove orphaned model definitions --- models/staging/vocabulary/_vocabulary__model.yml | 11 ----------- models/staging/vocabulary/_vocabulary__sources.yml | 2 -- 2 files changed, 13 deletions(-) diff --git a/models/staging/vocabulary/_vocabulary__model.yml b/models/staging/vocabulary/_vocabulary__model.yml index 66f710c..7c1a409 100644 --- a/models/staging/vocabulary/_vocabulary__model.yml +++ b/models/staging/vocabulary/_vocabulary__model.yml @@ -75,14 +75,3 @@ models: - name: valid_start_date - name: valid_end_date - name: invalid_reason - - name: stg_vocabulary__source_to_concept_map - columns: - - name: source_code - - name: source_vocabulary_id - - name: source_code_description - - name: target_concept_id - - name: target_vocabulary_id - - name: target_domain_id - - name: valid_start_date - - name: valid_end_date - - name: invalid_reason \ No newline at end of file diff --git a/models/staging/vocabulary/_vocabulary__sources.yml b/models/staging/vocabulary/_vocabulary__sources.yml index a9b0cdf..f4cbc12 100644 --- a/models/staging/vocabulary/_vocabulary__sources.yml +++ b/models/staging/vocabulary/_vocabulary__sources.yml @@ -22,5 +22,3 @@ sources: identifier: "{% if var('seed_source', false) %}relationship_seed{% else %}relationship{% endif %}" - name: vocabulary identifier: "{% if var('seed_source', false) %}vocabulary_seed{% else %}vocabulary{% endif %}" - - name: source_to_concept_map - identifier: "{% if var('seed_source', false) %}source_to_concept_map_seed{% else %}source_to_concept_map{% endif %}" \ No newline at end of file