CassandraLoader#
- class langchain_community.document_loaders.cassandra.CassandraLoader(table: Optional[str] = None, session: Optional[Session] = None, keyspace: Optional[str] = None, query: Union[str, Statement, None] = None, page_content_mapper: Callable[[Any], str] = <class 'str'>, metadata_mapper: Callable[[Any], dict] = <function CassandraLoader.<lambda>>, *, query_parameters: Union[dict, Sequence, None] = None, query_timeout: Optional[float] = <object object>, query_trace: bool = False, query_custom_payload: Optional[dict] = None, query_execution_profile: Any = <object object>, query_paging_state: Any = None, query_host: Optional[Host] = None, query_execute_as: Optional[str] = None)[source]#
Document Loader for Apache Cassandra.
- Parameters:
table (Optional[str]) β The table to load the data from. (do not use together with the query parameter)
session (Optional[Session]) β The cassandra driver session. If not provided, the cassio resolved session will be used.
keyspace (Optional[str]) β The keyspace of the table. If not provided, the cassio resolved keyspace will be used.
query (Union[str, Statement, None]) β The query used to load the data. (do not use together with the table parameter)
page_content_mapper (Callable[[Any], str]) β a function to convert a row to string page content. Defaults to the str representation of the row.
metadata_mapper (Callable[[Any], dict]) β a function to convert a row to document metadata.
query_parameters (Union[dict, Sequence, None]) β The query parameters used when calling session.execute .
query_timeout (Optional[float]) β The query timeout used when calling session.execute .
query_trace (bool) β Whether to use tracing when calling session.execute .
query_custom_payload (Optional[dict]) β The query custom_payload used when calling session.execute .
query_execution_profile (Any) β The query execution_profile used when calling session.execute .
query_host (Optional[Host]) β The query host used when calling session.execute .
query_execute_as (Optional[str]) β The query execute_as used when calling session.execute .
query_paging_state (Any) β
Methods
__init__
([table,Β session,Β keyspace,Β query,Β ...])Document Loader for Apache Cassandra.
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__(table: Optional[str] = None, session: Optional[Session] = None, keyspace: Optional[str] = None, query: Union[str, Statement, None] = None, page_content_mapper: Callable[[Any], str] = <class 'str'>, metadata_mapper: Callable[[Any], dict] = <function CassandraLoader.<lambda>>, *, query_parameters: Union[dict, Sequence, None] = None, query_timeout: Optional[float] = <object object>, query_trace: bool = False, query_custom_payload: Optional[dict] = None, query_execution_profile: Any = <object object>, query_paging_state: Any = None, query_host: Optional[Host] = None, query_execute_as: Optional[str] = None) None [source]#
Document Loader for Apache Cassandra.
- Parameters:
table (Optional[str]) β The table to load the data from. (do not use together with the query parameter)
session (Optional[Session]) β The cassandra driver session. If not provided, the cassio resolved session will be used.
keyspace (Optional[str]) β The keyspace of the table. If not provided, the cassio resolved keyspace will be used.
query (Union[str, Statement, None]) β The query used to load the data. (do not use together with the table parameter)
page_content_mapper (Callable[[Any], str]) β a function to convert a row to string page content. Defaults to the str representation of the row.
metadata_mapper (Callable[[Any], dict]) β a function to convert a row to document metadata.
query_parameters (Union[dict, Sequence, None]) β The query parameters used when calling session.execute .
query_timeout (Optional[float]) β The query timeout used when calling session.execute .
query_trace (bool) β Whether to use tracing when calling session.execute .
query_custom_payload (Optional[dict]) β The query custom_payload used when calling session.execute .
query_execution_profile (Any) β The query execution_profile used when calling session.execute .
query_host (Optional[Host]) β The query host used when calling session.execute .
query_execute_as (Optional[str]) β The query execute_as used when calling session.execute .
query_paging_state (Any) β
- Return type:
None
- async alazy_load() AsyncIterator[Document] [source]#
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 CassandraLoader