AthenaLoader#

class langchain_community.document_loaders.athena.AthenaLoader(query: str, database: str, s3_output_uri: str, profile_name: str | None = None, metadata_columns: List[str] | None = 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.

  • profile_name (Optional[str]) – Optional. AWS credential profile, if profiles are being used.

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

Methods

__init__(query,Β database,Β s3_output_uri[,Β ...])

Initialize Athena document loader.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

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 | None = None, metadata_columns: List[str] | None = 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.

  • profile_name (str | None) – Optional. AWS credential profile, if profiles are being used.

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

async alazy_load() β†’ AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() β†’ List[Document]#

Load data into Document objects.

Return type:

List[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: TextSplitter | None = 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]

Examples using AthenaLoader