Toggle Menu
Prev Up Next

# `langchain_community.document_loaders.cassandra`.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)

  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.

    - 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_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 .

    - metadata_mapper (Callable[[Any], dict]) –

    - query_trace (bool) –

    - query_paging_state (Any) –

  Methods

  `__init__`([table, session, keyspace, query, ...]) | Document Loader for Apache Cassandra.
  `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__(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

    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.

      - 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_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 .

      - metadata_mapper (Callable[[Any], dict]) –

      - query_trace (bool) –

      - query_paging_state (Any) –

    Return type

      None

  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]

    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]

# Examples using CassandraLoader

- Cassandra

- cassandra.md