Notion is a collaboration platform with modified Markdown support that integrates kanban boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management, and project and task management.
NotionDBLoader
is a Python class for loading content from a Notion
database. It retrieves pages from the database, reads their content, and returns a list of Document objects. NotionDirectoryLoader
is used for loading data from a Notion database dump.
Notion
DatabaseCreate a new table database in Notion. You can add any column to the database and they will be treated as metadata. For example you can add the following columns:
Add your content to the body of each page in the database. The NotionDBLoader will extract the content and metadata from these pages.
2. Create a Notion IntegrationTo create a Notion Integration, follow these steps:
Integration Token (API key)
. Copy this token and keep it safe, as you'll need it to use the NotionDBLoader.To connect your integration to the database, follow these steps:
To get the database ID, follow these steps:
With the database properly set up and the integration token and database ID in hand, you can now use the NotionDBLoader code to load content and metadata from your Notion database.
5. InstallationInstaall the langchain-community
integration package.
%pip install -qU langchain-community
Notion Database Loader
NotionDBLoader is part of the langchain package's document loaders. You can use it as follows:
from getpass import getpass
NOTION_TOKEN = getpass()
DATABASE_ID = getpass()
from langchain_community.document_loaders import NotionDBLoader
loader = NotionDBLoader(
integration_token=NOTION_TOKEN,
database_id=DATABASE_ID,
request_timeout_sec=30,
)
Notion Directory Loader Setup
Export your dataset from Notion. You can do this by clicking on the three dots in the upper right hand corner and then clicking Export
.
When exporting, make sure to select the Markdown & CSV
format option.
This will produce a .zip
file in your Downloads folder. Move the .zip
file into this repository.
Run the following command to unzip the zip file (replace the Export...
with your own file name as needed).
unzip Export-d3adfe0f-3131-4bf3-8987-a52017fc1bae.zip -d Notion_DB
Usage
Run the following command to ingest the data you just downloaded.
from langchain_community.document_loaders import NotionDirectoryLoader
loader = NotionDirectoryLoader("Notion_DB")
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4