Search code examples
prestotrino

Is it possible to rename a Presto view?


Is it possible to rename a Presto view?

I know I can accomplish this via dropping the view and recreating it with the new name, but I'd prefer to be able to rename the view directly.

Something like this would be nice, but from what I can tell so far this is not supported:

-- rename view 
ALTER VIEW hive.foo.my_view RENAME TO hive.foo.renamed_view;

-- move view to a different schema
ALTER VIEW hive.foo.my_view RENAME TO hive.bar.my_view;

The relevant version is Presto 0.212.


Solution

  • This isn't possible today in Presto, but is a good feature request. I filed an issue to track it: https://github.com/prestosql/presto/issues/1037

    For views in the Hive connector, it might be possible to rename them using Hive, since they are stored in the metastore as a Hive view (although they are Presto syntax and format so not queryable by Hive).