From 9356081662f4359bd390bc8b79cc4ebacc1483cd Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 28 Apr 2022 00:51:21 -0400 Subject: [PATCH] only create foreign tables where the foreign key is not a date --- setup_sql/03_build_master_tables.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup_sql/03_build_master_tables.sql b/setup_sql/03_build_master_tables.sql index 424a98a..a087d54 100644 --- a/setup_sql/03_build_master_tables.sql +++ b/setup_sql/03_build_master_tables.sql @@ -27,9 +27,8 @@ BEGIN FROM fc.target_meta tm WHERE - func IS NOT NULL - --if func is populated for a date type, a foreign table will be setup unless excluded here or func not populated - --AND dtype <> 'date' + --only create master tables that don't have date as a foreign key + func IN (SELECT DISTINCT func FROM fc.target_meta WHERE fkey IS NOT NULL AND func IS NOT NULL AND dtype <> 'date') GROUP BY schema ,tname