# Amazon Athena

To query Tableflow tables using Athena, we recommend using Tableflow's [AWS Glue integration](https://docs.warpstream.com/warpstream/tableflow/catalogs-and-query-engines/aws-glue) to manage the table. This ensures that the query runs against latest metadata version file.

You can also use the "CREATE TABLE" command directly in Athena. This will create a new Iceberg table and register it with the AWS Glue Data Catalog, but it requires manual updates to the latest metadata version file.

```sql
CREATE TABLE [db_name.]table_name
(col_name data_type [COMMENT col_comment] [, ...] ) // schema of table here
LOCATION 's3://demo-bucket/_tableflow/path/to/table'
TBLPROPERTIES (
  'table_type' = 'ICEBERG',
  'format' = 'parquet'
);
```

{% hint style="info" %}
Athena create table always creates an empty table. Before querying the table, we need to update the table property of "metadata\_location" to point to latest metadata version file.\
\
Go to AWS Glue Data Catalog -> Tables -> Select your Tableflow table -> Actions -> Edit Table -> update "metadata\_location" in Table properties
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.warpstream.com/warpstream/tableflow/catalogs-and-query-engines/amazon-athena.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
