简体   繁体   中英

How to find all of the tables that are used in a view in Redshift?

I'm trying to find a way of finding all of the tables that are used by a particular view in a list. Is there a Redshift Table/a query that I could run that I could use to find this information? I want to be able to insert the name of a view, and have all the tables used in this view returned as the output. Thank you.

There's no direct, supported mechanism to do this.

I do it by getting the SQL of the view from pg_views and then parsing it using pglast (a Python module) and from that, extracting the table and views names used by the view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM