Difference between Athena table and Athena Views.

Gauravkumar
2 min readSep 29, 2023

Introduction:

Amazon Athena is a robust query service that enables users to analyze data directly in Amazon Simple Storage Service (Amazon S3) using SQL. It eliminates the necessity to manage any infrastructure, allowing a focus on analyzing data with the assurance of paying only for the queries executed. This article will explore the functionalities of Athena Tables and Athena Views, emphasizing the utility and efficiency of Athena Views in automating and managing project workflows.

Understanding AWS Athena:

Amazon AWS Athena is a service that empowers users to interact with their data stored in Amazon S3 using SQL, a prominent database communication language. The salient feature of Athena is that it requires no infrastructure management, such as servers, allowing users to run queries and only incur costs for the queries they execute.

Concept of Athena Views:

An Athena View is a virtual table and does not store any data. It is formulated by combining data from one or more existing tables, creating a new, on-the-spot table for specific data needs. Views simplify intricate queries by consolidating data from various tables and can act as a precise filter, displaying selective columns or rows to specific users.

Differentiating Athena Tables and Athena Views:

In the realm of Amazon Athena, tables are fundamental entities that hold the raw data and are updated regularly. In contrast, a view is like a predefined query template, a virtual table created for specific, momentary needs without holding any data.

Application in Project Workflow:

In my project scenario, the Athena table is updated automatically on a regular basis. The raw data arriving in the Athena table transforms, cleaning, joining, and unnesting through a series of SQL queries, subsequently generating a new table.

The challenge arose in automating the execution of these queries whenever new data was integrated into the original table. While AWS provides numerous services like Lambda, ETL, and Glue to automate queries, they require substantial effort and resources to set up.

Optimizing Workflow with Athena Views:

After extensive research, Athena Views emerged as the optimal solution for automating tasks without additional setups or alterations. It only necessitated the creation of a view and the execution of the query within the view, as exemplified below:

CREATE VIEW topic AS
SELECT a, a+b, c, d
FROM topics;

Implementing this approach streamlined my workflow significantly, yielding 100% accurate results as per expectations. The continuous monitoring for a week revealed that the integration of new raw data into the table was seamlessly reflected in the views post the execution of the customized query created by me.

Conclusion:

Athena Views have proven to be an invaluable asset in optimizing costs and enhancing speed and efficiency in handling data. The feature of not necessitating any automation reduces the effort and resources involved, making it a favorable choice for managing and automating project workflows.

This practical application of Athena Views demonstrates its potential in simplifying complex workflows, offering a resource-efficient method to handle and analyze data, and ensuring the integrity and accuracy of the results.

--

--