langchain_community.document_loaders.athena.AthenaLoader¶

class langchain_community.document_loaders.athena.AthenaLoader(query: str, database: str, s3_output_uri: str, profile_name: str, metadata_columns: Optional[List[str]] = None)[source]¶

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.

Initialize Athena document loader.

Parameters
  • query (str) – The query to run in Athena.

  • database (str) – Athena database

  • s3_output_uri (str) – Athena output path

  • metadata_columns (Optional[List[str]]) – Optional. Columns written to Document metadata.

  • profile_name (str) –

Methods

__init__(query, database, s3_output_uri, ...)

Initialize Athena document loader.

alazy_load()

A lazy loader for Documents.

lazy_load()

A lazy loader for Documents.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(query: str, database: str, s3_output_uri: str, profile_name: str, metadata_columns: Optional[List[str]] = None)[source]¶

Initialize Athena document loader.

Parameters
  • query (str) – The query to run in Athena.

  • database (str) – Athena database

  • s3_output_uri (str) – Athena output path

  • metadata_columns (Optional[List[str]]) – Optional. Columns written to Document metadata.

  • profile_name (str) –

async alazy_load() AsyncIterator[Document]¶

A lazy loader for Documents.

Return type

AsyncIterator[Document]

lazy_load() Iterator[Document][source]¶

A lazy loader for Documents.

Return type

Iterator[Document]

load() List[Document]¶

Load data into Document objects.

Return type

List[Document]

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Return type

List[Document]