How to get the ddl of a view in Redshift database

DDL of views can be obtained from information_schema.views. Below is the sql to get the view definition where schemaname is the name of the schema and viewname is the name of the view.

select view_definition from information_schema.views where table_schema='schemaname' and table_name='viewname';
See also  How to change the connection limit of a Redshift database