AWS Athena is a popular data warehousing system used to analyze large data lakes. Built on the powerful Trino (formerly Presto) open-source technology, it simplifies the process of gaining insights from large volumes of columnar data. Integrating Waii's text-to-SQL and chat technologies with Athena creates a powerful combination, allowing you to use natural language to analyze data lakes effortlessly.
Using Waii with Athena is especially well-suited due to its high accuracy and our bespoke compiler / optimizer designed specifically for Athena. This ensures that queries not only work seamlessly but are also optimized for performance. It’s a must-have for conversational analytics.
Example:
Querying Sales Data in Athena with Waii
1. Natural Language Query: "Show me the revenue of items sold in California stores in the first quarter of 2024, highlighting items with revenue significantly below the average."
2. Waii's Text-to-SQL Conversion:
WITH avg_item_revenue AS (
SELECT
ss.store_sk,
d.year,
AVG((ss.sales_price - ss.ext_discount_amt) * ss.quantity) AS avg_revenue
FROM tweakit_playground.retail_data.store_sales AS ss
INNER JOIN tweakit_playground.retail_data.date_dim AS d
ON ss.sold_date_sk = d.date_sk
WHERE
d.year = 2024 AND d.qoy = 1
GROUP BY
ss.store_sk,
d.year
),
item_revenue AS (
SELECT
ss.store_sk,
d.year,
ss.item_sk,
(ss.sales_price - ss.ext_discount_amt) * ss.quantity AS revenue
FROM tweakit_playground.retail_data.store_sales AS ss
INNER JOIN tweakit_playground.retail_data.date_dim AS d
ON ss.sold_date_sk = d.date_sk
WHERE
d.year = 2024 AND d.qoy = 1
),
filtered_items AS (
SELECT
ir.store_sk,
ir.year,
ir.item_sk
FROM item_revenue AS ir
INNER JOIN avg_item_revenue AS ar
ON ir.store_sk = ar.store_sk AND ir.year = ar.year
WHERE
ir.revenue < 0.1 * ar.avg_revenue
)
SELECT
s.store_id,
s.store_name,
i.item_id,
i.product_name,
fi.year
FROM filtered_items AS fi
INNER JOIN tweakit_playground.retail_data.store AS s
ON fi.store_sk = s.store_sk
INNER JOIN tweakit_playground.retail_data.item AS i
ON fi.item_sk = i.item_sk
WHERE
s.state ILIKE '%CA%'
ORDER BY
fi.year,
s.store_id,
i.item_id;
3. Execution in Athena: The query is executed in Athena, leveraging our bespoke compiler and optimizer to ensure efficient data retrieval and performance.
This integration brings the power of natural language processing to your data analytics, making it easier and faster to gain insights from your data lakes.