by drx · 3y ago · 0 comments
with source as (
select * from wherever
),
transformed as (
...
),
joined as (
...
),
final as (
...
)
select * from final
You can switch `final` to `transformed` to see what the query is doing internally. Almost like having good control flow. Almost.source = ...
transformed = ...
joined = ...
final = ...
generally can't just swap transformed in final because final depends on the output of transformed?
This works as long as your CTE’s are correct SQL and only the logic is wrong or suspect.
From a debug point of view that feels more convenient to _me_.
Edit: also I don’t like to leave a mess behind and CTE’s don’t require cleaning up afterwards.