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.
A lazy loader for Documents.
aload
()Load data into Document objects.
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]
- lazy_load() Iterator[Document] [source]#
A lazy loader for Documents.
- Return type:
Iterator[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