-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: extend tests with scenario that nothing is listed in except
- Loading branch information
Showing
1 changed file
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |