diff --git a/integration_tests/models/test_star.sql b/integration_tests/models/test_star.sql index a182d9d..70109d5 100644 --- a/integration_tests/models/test_star.sql +++ b/integration_tests/models/test_star.sql @@ -1,6 +1,22 @@ -{# This tests that we can successfully create a table except a column, which we create outside of the star macro. -In case the except wouldn't work, this SQL statement would fail due to duplicate column aliases. #} +{# This model tests whether we can create successfully the tables using the star macro in different scenarios. +When the star macro doesn't work as expected, the SQL statements fail due to duplicate column aliases. #} + +{# Select all, except a list of columns. This works as expected when we can create select statements with the aliases listed in the except. #} +with Select_all_except as ( + select + {{ pm_utils.star(ref('input_table'), except=['Column_A']) }}, + 'A' as `Column_A` + from {{ ref('input_table') }} +), + +{# Select all columns. This works as expected when we can use the columns in a next transformation. #} +Select_all as ( + select + {{ pm_utils.star(ref('input_table')) }} + from {{ ref('input_table') }} +) + select - {{ pm_utils.star(ref('input_table'), except=['Column_B']) }}, - 'B' as `Column_B` -from {{ ref('input_table') }} + `Column_A`, + `Column_B` +from Select_all