# AthenaLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/athena/AthenaLoader)

Load documents from `AWS Athena`.

Each document represents one row of the result.
- By default, all columns are written into the `page_content` of the document
and none into the `metadata` of the document.
- If `metadata_columns` are provided then these columns are written
into the `metadata` of the document while the rest of the columns
are written into the `page_content` of the document.

To authenticate, the AWS client uses this method to automatically load credentials:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

If a specific credential profile should be used, you must pass
the name of the profile from the ~/.aws/credentials file that is to be used.

Make sure the credentials / roles used have the required policies to
access the Amazon Textract service.

## Signature

```python
AthenaLoader(
    self,
    query: str,
    database: str,
    s3_output_uri: str,
    profile_name: Optional[str] = None,
    metadata_columns: Optional[List[str]] = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | `str` | Yes | The query to run in Athena. |
| `database` | `str` | Yes | Athena database. |
| `s3_output_uri` | `str` | Yes | Athena output path. |
| `profile_name` | `Optional[str]` | No | Optional. AWS credential profile, if profiles are being used. (default: `None`) |
| `metadata_columns` | `Optional[List[str]]` | No | Optional. Columns written to Document `metadata`. (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    query: str,
    database: str,
    s3_output_uri: str,
    profile_name: Optional[str] = None,
    metadata_columns: Optional[List[str]] = None,
)
```

| Name | Type |
|------|------|
| `query` | `str` |
| `database` | `str` |
| `s3_output_uri` | `str` |
| `profile_name` | `Optional[str]` |
| `metadata_columns` | `Optional[List[str]]` |


## Properties

- `query`
- `database`
- `s3_output_uri`
- `metadata_columns`
- `athena_client`
- `s3_client`

## Methods

- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/document_loaders/athena/AthenaLoader/lazy_load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/athena.py#L13)