Toggle Menu
Prev Up Next

# `langchain_community.document_loaders.max_compute`.MaxComputeLoader

class langchain_community.document_loaders.max_compute.MaxComputeLoader(query: str, api_wrapper: MaxComputeAPIWrapper, *, page_content_columns: Optional[Sequence[str]] = None, metadata_columns: Optional[Sequence[str]] = None)

  Load from Alibaba Cloud MaxCompute table.

  Initialize Alibaba Cloud MaxCompute document loader.

  Parameters

    - query (str) – SQL query to execute.

    - api_wrapper (MaxComputeAPIWrapper) – MaxCompute API wrapper.

    - page_content_columns (Optional[Sequence[str]]) – The columns to write into the page_content of the Document. If unspecified, all columns will be written to page_content.

    - metadata_columns (Optional[Sequence[str]]) – The columns to write into the metadata of the Document. If unspecified, all columns not added to page_content will be written.

  Methods

  `__init__`(query, api_wrapper, *[, ...]) | Initialize Alibaba Cloud MaxCompute document loader.
  `alazy_load`() | A lazy loader for Documents.
  `aload`() | Load data into Document objects.
  `from_params`(query, endpoint, project, *[, ...]) | Convenience constructor that builds the MaxCompute API wrapper from
  `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, api_wrapper: MaxComputeAPIWrapper, *, page_content_columns: Optional[Sequence[str]] = None, metadata_columns: Optional[Sequence[str]] = None)

    Initialize Alibaba Cloud MaxCompute document loader.

    Parameters

      - query (str) – SQL query to execute.

      - api_wrapper (MaxComputeAPIWrapper) – MaxCompute API wrapper.

      - page_content_columns (Optional[Sequence[str]]) – The columns to write into the page_content of the Document. If unspecified, all columns will be written to page_content.

      - metadata_columns (Optional[Sequence[str]]) – The columns to write into the metadata of the Document. If unspecified, all columns not added to page_content will be written.

  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]

  classmethod from_params(query: str, endpoint: str, project: str, *, access_id: Optional[str] = None, secret_access_key: Optional[str] = None, **kwargs: Any) → MaxComputeLoader
    Convenience constructor that builds the MaxCompute API wrapper from

      given parameters.

    Parameters

      - query (str) – SQL query to execute.

      - endpoint (str) – MaxCompute endpoint.

      - project (str) – A project is a basic organizational unit of MaxCompute, which is similar to a database.

      - access_id (Optional[str]) – MaxCompute access ID. Should be passed in directly or set as the environment variable MAX_COMPUTE_ACCESS_ID.

      - secret_access_key (Optional[str]) – MaxCompute secret access key. Should be passed in directly or set as the environment variable MAX_COMPUTE_SECRET_ACCESS_KEY.

      - kwargs (Any) –

    Return type

      MaxComputeLoader

  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 MaxComputeLoader

- Alibaba Cloud

- alibaba_cloud_maxcompute.md