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';