Views dependency in Redshift

263 views Asked by At

I've got a scenario where my team has built views which relies on other views.

Problem arises when I try to drop and rebuild a view. It removes all the dependent views (drop cascade).

Is there a way to identify views relaying on other views dependency in Redshift?

I know there is a STV_MV_DEPS table to view materialized view dependency but I'm interested in understanding which views relies on which views.

Thanks in advance

1

There are 1 answers

4
Bill Weiner On

awslabs has a good git repo of utilities that come in handy at times like this. https://github.com/awslabs/amazon-redshift-utils

The util you want is likely - https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_view_dependency.sql

If you don't want this util as a view you can just run the SELECT this view use standalone.