From 1bc8069ac1f5a7ddd53f59cacd77085836c4483b Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Tue, 12 Jun 2018 13:39:34 -0400 Subject: [PATCH 1/3] potential fix for slow parsing of union_tables macro --- macros/sql/union.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/sql/union.sql b/macros/sql/union.sql index 5709f8bcdcf..59eb022d536 100644 --- a/macros/sql/union.sql +++ b/macros/sql/union.sql @@ -1,5 +1,10 @@ {% macro union_tables(tables, column_override=none, exclude=none) -%} + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} + {%- if not execute -%} + {{ return('') }} + {% endif %} + {%- set exclude = exclude if exclude is not none else [] %} {%- set column_override = column_override if column_override is not none else {} %} From f3450d41172dc44385b1ecde5bad902313944ece Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Tue, 12 Jun 2018 14:21:24 -0400 Subject: [PATCH 2/3] dont run queries in parsing mode --- macros/sql/star.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/sql/star.sql b/macros/sql/star.sql index d98ba90022b..25cdc4b84e8 100644 --- a/macros/sql/star.sql +++ b/macros/sql/star.sql @@ -1,5 +1,10 @@ {% macro star(from, except=[]) -%} + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} + {%- if not execute -%} + {{ return('') }} + {% endif %} + {%- if from.name -%} {%- set schema_name, table_name = from.schema, from.name -%} {%- else -%} From 1793e06c6fe866aacd4920a6e3b11c99d5df44e8 Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Tue, 12 Jun 2018 15:34:39 -0400 Subject: [PATCH 3/3] dont run in parsing for equality schema test --- macros/schema_tests/equality.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/schema_tests/equality.sql b/macros/schema_tests/equality.sql index 6ce516761ac..06df33bceda 100644 --- a/macros/schema_tests/equality.sql +++ b/macros/schema_tests/equality.sql @@ -1,6 +1,10 @@ {% macro test_equality(model, arg) %} +{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} +{%- if not execute -%} + {{ return('') }} +{% endif %} -- setup