-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Hello! Apologies if I'm misunderstanding the current implementation, but is this example supported in exclude_columns() table function?
with
my_cte as (
select
1 as a,
2 as b,
3 as c
)
select
*,
c + 2 as c
from table(exclude_columns(
input => table(my_cte),
columns => descriptor(c)
)) as excluded
Trying to return below without ambiguous column errors or duplicated columns:
a b c
1 2 5
If you use the table function here, you don't have access to 'c' for the calculation and would need to join back to the first CTE (assuming you have a unique primary key, if not you're out of luck) or you have to list explicit columns which is hard to scale as a solution for tables with more dynamic schemas.
With Select * Except it would look like this:
with
my_cte as (
select
1 as a,
2 as b,
3 as c
)
select * except (x),
x + 2 as x
from my_cte
Thank you and appreciate any thoughts or suggestions.