Toggle Menu
Prev Up Next

# `langchain_community.document_loaders.couchbase`.CouchbaseLoader

class langchain_community.document_loaders.couchbase.CouchbaseLoader(connection_string: str, db_username: str, db_password: str, query: str, *, page_content_fields: Optional[List[str]] = None, metadata_fields: Optional[List[str]] = None)

  Load documents from Couchbase.

  Each document represents one row of the result. The page_content_fields are written into the page_content`of the document. The `metadata_fields are written into the metadata of the document. By default, all columns are written into the page_content and none into the metadata.

  Initialize Couchbase document loader.

  Parameters

    - connection_string (str) – The connection string to the Couchbase cluster.

    - db_username (str) – The username to connect to the Couchbase cluster.

    - db_password (str) – The password to connect to the Couchbase cluster.

    - query (str) – The SQL++ query to execute.

    - page_content_fields (Optional[List[str]]) – The columns to write into the page_content field of the document. By default, all columns are written.

    - metadata_fields (Optional[List[str]]) – The columns to write into the metadata field of the document. By default, no columns are written.

  Methods

  `__init__`(connection_string, db_username, ...) | Initialize Couchbase document loader.
  `alazy_load`() | A lazy loader for Documents.
  `aload`() | Load data into Document objects.
  `lazy_load`() | Load Couchbase data into Document objects lazily.
  `load`() | Load data into Document objects.
  `load_and_split`([text_splitter]) | Load Documents and split into chunks.

  __init__(connection_string: str, db_username: str, db_password: str, query: str, *, page_content_fields: Optional[List[str]] = None, metadata_fields: Optional[List[str]] = None) → None

    Initialize Couchbase document loader.

    Parameters

      - connection_string (str) – The connection string to the Couchbase cluster.

      - db_username (str) – The username to connect to the Couchbase cluster.

      - db_password (str) – The password to connect to the Couchbase cluster.

      - query (str) – The SQL++ query to execute.

      - page_content_fields (Optional[List[str]]) – The columns to write into the page_content field of the document. By default, all columns are written.

      - metadata_fields (Optional[List[str]]) – The columns to write into the metadata field of the document. By default, no columns are written.

    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]

    Load Couchbase data into Document objects lazily.

    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 CouchbaseLoader

- Couchbase

- query is a valid SQL++ query