Notion Database

Query a public Notion database, supporting both basic information and SQL query.

This widget supports multiple actions. For a more comprehensive understanding of its functionality, we recommend reviewing the following documentation carefully.

You need to pass both the action and other input parameters of the chosen action to your module_config

Try it in the Widget Center

Click this url to try this widget and copy the Pro Config template.

Usage

Query the Whole Database

action query_all

Input Parameters

NameTypeDescriptionDefaultRequired

url

string

URL of the public database

action

string

The action you want to perform

query_all

Output Parameters

NameTypeDescriptionFile Type

data

array

The returned database in list

Output Example

{
  "data": [
    {
      "Age": "15",
      "Name": "Jack",
      "Password": "password1",
      "Phone Number": "13033331111"
    },
    {
      "Age": "34",
      "Name": "Taylor",
      "Password": "password2",
      "Phone Number": "13100001111"
    },
    {
      "Age": "17",
      "Name": "Harry",
      "Password": "password3",
      "Phone Number": "13888883333"
    },
    {
      "Age": "43",
      "Name": "Sherlock",
      "Password": "password4",
      "Phone Number": "15909098787"
    }
  ]
}

Obtain the Column Names

action query_schema

Input Parameters

NameTypeDescriptionDefaultRequired

url

string

URL of the public database

action

string

The action you want to perform

query_schema

Output Parameters

NameTypeDescriptionFile Type

data

array

The column names of the database

Output Example

{
  "data": [
    "Phone Number",
    "Age",
    "Password",
    "Name"
  ]
}

Query All Values of a Specific Column

action query_column

Input Parameters

NameTypeDescriptionDefaultRequired

url

string

URL of the public database

action

string

The action you want to perform

query_column

column_name

string

Colume name to query

Output Parameters

NameTypeDescriptionFile Type

data

array

The values under a specific column

Output Example

{
  "data": [
    "Jack",
    "Taylor",
    "Harry",
    "Sherlock"
  ]
}

Query The Database with SQL

action query_sql

This action provides an advanced query with SQL. The table name is defined as DATA

Input Parameters

NameTypeDescriptionDefaultRequired

url

string

URL of the public database

action

string

The action you want to perform

query_sql

sql_str

string

SQL string to query, please use it like 'SELECT * FROM database'

SELECT * FROM DATA WHERE Age < 18

Output Parameters

NameTypeDescriptionFile Type

data

array

The query results of the public Notion database

Output Example

{
  "data": [
    {
      "Age": "15",
      "Name": "Jack",
      "Password": "password1",
      "Phone Number": "13033331111"
    },
    {
      "Age": "17",
      "Name": "Harry",
      "Password": "password3",
      "Phone Number": "13888883333"
    }
  ]
}

Detailed Guidelines

In notion, we can type /database to create a database. Then click the open as full page as below:

click the share button and copy the url to feed into your Notion Database widget:

Last updated