Skip to content

Commit

Permalink
test: extend tests with scenario that nothing is listed in except
Browse files Browse the repository at this point in the history
  • Loading branch information
cverhoef committed Apr 23, 2024
1 parent 757c1e9 commit 247063a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions integration_tests/models/test_star.sql
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 247063a

Please sign in to comment.