langchain_community.document_loaders.notiondb.NotionDBLoader¶

class langchain_community.document_loaders.notiondb.NotionDBLoader(integration_token: str, database_id: str, request_timeout_sec: Optional[int] = 10, *, filter_object: Optional[Dict[str, Any]] = None)[source]¶

Load from Notion DB.

Reads content from pages within a Notion Database. :param integration_token: Notion integration token. :type integration_token: str :param database_id: Notion database id. :type database_id: str :param request_timeout_sec: Timeout for Notion requests in seconds.

Defaults to 10.

Parameters
  • filter_object (Dict[str, Any]) –

    Filter object used to limit returned entries based on specified criteria. E.g.: {

    ”timestamp”: “last_edited_time”, “last_edited_time”: {

    ”on_or_after”: “2024-02-07”

    }

    } -> will only return entries that were last edited

    on or after 2024-02-07

    Notion docs: https://developers.notion.com/reference/post-database-query-filter Defaults to None, which will return ALL entries.

  • integration_token (str) –

  • database_id (str) –

  • request_timeout_sec (int) –

Initialize with parameters.

Methods

__init__(integration_token, database_id[, ...])

Initialize with parameters.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

lazy_load()

A lazy loader for Documents.

load()

Load documents from the Notion database.

load_and_split([text_splitter])

Load Documents and split into chunks.

load_page(page_summary)

Read a page.

__init__(integration_token: str, database_id: str, request_timeout_sec: Optional[int] = 10, *, filter_object: Optional[Dict[str, Any]] = None) None[source]¶

Initialize with parameters.

Parameters
  • integration_token (str) –

  • database_id (str) –

  • request_timeout_sec (Optional[int]) –

  • filter_object (Optional[Dict[str, 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][source]¶

Load documents from the Notion database. :returns: List of documents. :rtype: List[Document]

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]

load_page(page_summary: Dict[str, Any]) Document[source]¶

Read a page.

Parameters

page_summary (Dict[str, Any]) – Page summary from Notion API.

Return type

Document

Examples using NotionDBLoader¶