Notion plugin

This plugin allows you to interact with Notion databases. You can read/insert/update/delete records in a database.

Installation

You need Anyquery to run this plugin.

Then, install the plugin with the following command:

anyquery install notion

At some point, you will be asked to provide your Notion API key. You can find it by creating an integration.

Find your Notion API key

  1. Go to Notion's My Integrations page.

  2. Click on the + New integration button.

    Home of Notion integrations

  3. Fill in the form with the following information:

    1. Name: Whatever you want
    2. Associated workspace: The workspace you want the plugin to have access to
    3. Type: Internal

    A form to create a new integration

  4. Click on the Save button and on Configure integration settings.

    alt text

  5. Copy the token and paste it when asked by the plugin. alt text

  6. Share each database you want to query with the integration you just created.

    1. Open the database you want to share.
    2. Click on the three dots in the top right corner.
    3. Scroll down, hover over Connect to and click on the integration you just created. alt text
  7. Congratulations! You can now query your Notion databases.

Finding the database ID

Once you have your API key, you need to find the database ID of the database you want to interact with. You can find it in the URL of the database. For example, if the URL of the database is https://www.notion.so/myworkspace/My-Database-1234567890abcdef1234567890abcdef, the database ID is 1234567890abcdef1234567890abcdef.

Usage

The plugin supports all the basic SQL operations. Here are some examples:

SELECT * FROM notion_database;

SELECT * FROM notion_database WHERE name = 'Michael';

INSERT INTO notion_database (name, age) VALUES ('Michael', 25);

UPDATE notion_database SET age = 26 WHERE name = 'Michael';

DELETE FROM notion_database WHERE name = 'Michael';

Known limitations