Notion
Notion is an all-in-one workspace for note-taking, project management, and database management.
ingestr supports Notion as a source.
URI format
The URI format for Notion is as follows:
notion://?api_key=tokenURI parameters:
api_key: the integration token used for authentication with the Notion API
The URI is used to connect to the Notion API for extracting data. More details on setting up Notion integrations can be found here.
Setting up a Notion Integration
To connect to Notion, you need to create an internal integration and share your database with it.
Step 1: Create an Integration
- Go to Notion Integrations
- Click + New integration
- Select the workspace where your database is located
- Give your integration a name (e.g., "Data Integration")
- Under Capabilities, ensure at least Read content is enabled
- Click Submit
Step 2: Get the API Key
- After creating the integration, you'll see an Internal Integration Secret
- Click Show and then Copy to get your API key (starts with
secret_) - Store this key securely
Step 3: Share Your Database with the Integration
- Open the Notion database you want to access
- Click the ... menu in the top-right corner
- Click Add connections (or Connect to)
- Search for and select your integration
- Click Confirm
Step 4: Get Your Database ID
- Open your database in Notion
- Look at the URL in your browser
- The database ID is the 32-character string after your workspace name and before the
?
For example, in this URL:
https://www.notion.so/myworkspace/bfeaafc0c25f40a9asdasd672a9456f3?v=...The database ID is bfeaafc0c25f40a9asdasd672a9456f3.
Once you have your API key and database ID, let's say your API token is secret_12345 and the database you'd like to connect to is bfeaafc0c25f40a9asdasd672a9456f3, here's a sample command that will copy the data from the Notion table into a DuckDB database:
ingestr ingest --source-uri 'notion://?api_key=secret_12345' --source-table 'bfeaafc0c25f40a9asdasd672a9456f3' --dest-uri duckdb:///notion.duckdb --dest-table 'dest.output'The result of this command will be a table in the notion.duckdb database with JSON columns.
CAUTION
Notion does not support incremental loading, which means every time you run the command, it will copy the entire table from Notion to the destination. This can be slow for large tables.