Work with Athena views
Athena views can be easily created, updated, and managed in the Athena console.
Create views
You can create a view in the Athena console by using a template or by running an existing query.
To use a template to create a view
-
In the Athena console, next to Tables and views, choose Create, and then choose Create view.
This action places an editable view template into the query editor.
-
Edit the view template according to your requirements. When you enter a name for the view in the statement, remember that view names cannot contain special characters other than underscore
(_)
. See Name databases, tables, and columns. Avoid using Escape reserved keywords in queries for naming views.For more information about creating views, see CREATE VIEW and CREATE DIALECT VIEW and Examples of Athena views.
-
Choose Run to create the view. The view appears in the list of views in the Athena console.
To create a view from an existing query
-
Use the Athena query editor to run an existing query.
-
Under the query editor window, choose Create, and then choose View from query.
-
In the Create View dialog box, enter a name for the view, and then choose Create. View names cannot contain special characters other than underscore
(_)
. See Name databases, tables, and columns. Avoid using Escape reserved keywords in queries for naming views.Athena adds the view to the list of views in the console and displays the
CREATE VIEW
statement for the view in the query editor.
Notes
-
If you delete a table on which a table is based and then attempt to run the view, Athena displays an error message.
-
You can create a nested view, which is a view on top of an existing view. Athena prevents you from running a recursive view that references itself.