Rows of a Notion data source as a typed table, one column per property
Positional arguments
Named arguments
rich_text_json :=
BOOLEAN
Returns columns
<title / rich_text property>
VARCHAR
<title / rich_text property>__json
JSON
<checkbox property>
BOOLEAN
<select / status property>
VARCHAR
<multi_select property>
VARCHAR[]
<people / relation property>
VARCHAR[]
<date property>
STRUCT of 4 fields
<created_time / last_edited_time property>
TIMESTAMP WITH TIME ZONE
<created_by / last_edited_by property>
VARCHAR
<url / email / phone_number property>
VARCHAR
<files property>
STRUCT of 4 fields[]
<unique_id property>
BIGINT
<formula property, text result>
VARCHAR
<formula property, boolean result>
BOOLEAN
<formula / rollup property, number result>
DOUBLE
<rollup property, show_original / show_unique>
VARCHAR[]
<formula / rollup property, date result>
STRUCT of 4 fields
<other property types>
JSON
created_time
TIMESTAMP WITH TIME ZONE
last_edited_time
TIMESTAMP WITH TIME ZONE
Attachments
STRUCT of 4 fields[]
Created
TIMESTAMP WITH TIME ZONE
Returns columns · depends on the arguments
<title / rich_text property>
VARCHAR
<title / rich_text property>__json
JSON
<checkbox property>
BOOLEAN
<select / status property>
VARCHAR
<multi_select property>
VARCHAR[]
<people / relation property>
VARCHAR[]
<date property>
STRUCT of 4 fields
<created_time / last_edited_time property>
TIMESTAMP WITH TIME ZONE
<created_by / last_edited_by property>
VARCHAR
<url / email / phone_number property>
VARCHAR
<files property>
STRUCT of 4 fields[]
<unique_id property>
BIGINT
<formula property, text result>
VARCHAR
<formula property, boolean result>
BOOLEAN
<formula / rollup property, number result>
DOUBLE
<rollup property, show_original / show_unique>
VARCHAR[]
<formula / rollup property, date result>
STRUCT of 4 fields
<other property types>
JSON
created_time
TIMESTAMP WITH TIME ZONE
last_edited_time
TIMESTAMP WITH TIME ZONE
Attachments
STRUCT of 4 fields[]
Created
TIMESTAMP WITH TIME ZONE
Examples (2)
Open tasks due from November on, with the status and date filters pushed into Notion
SELECT "Name", "Status", "Due".start AS due
FROM notion.main.query_data_source('1a2b3c4d-0000-4000-8000-00000000d501')
WHERE "Status" <> 'Done' AND "Due".start >= TIMESTAMPTZ '2026-11-01 00:00:00+00'
ORDER BY due;
Task count and estimate total per status
SELECT "Status", count(*) AS tasks, sum("Estimate") AS points
FROM notion.main.query_data_source('1a2b3c4d-0000-4000-8000-00000000d501')
GROUP BY "Status"
ORDER BY tasks DESC;