From a00a73ef18dce2ac0a74fb3bae2bf641be6e03f3 Mon Sep 17 00:00:00 2001 From: Noah Czelusta <83324596+swimninja247@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:37:34 -0500 Subject: [PATCH] Add last_edited_time and created_time props to NotionDBLoader (#11020) # Description Adds logic for NotionDBLoader to correctly populate `last_edited_time` and `created_time` fields from [page properties](https://developers.notion.com/reference/page#property-value-object). There are no relevant tests for this code to be updated. --------- Co-authored-by: Bagatur --- .../langchain/langchain/document_loaders/notiondb.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/langchain/langchain/document_loaders/notiondb.py b/libs/langchain/langchain/document_loaders/notiondb.py index bd7a81c896..d7728efcc8 100644 --- a/libs/langchain/langchain/document_loaders/notiondb.py +++ b/libs/langchain/langchain/document_loaders/notiondb.py @@ -121,11 +121,15 @@ class NotionDBLoader(BaseLoader): else [] ) elif prop_type == "date": - value = prop_data["date"] - elif prop_type == "created_time": - value = prop_data["created_time"] + value = prop_data["date"] if prop_data["date"] else None elif prop_type == "last_edited_time": - value = prop_data["last_edited_time"] + value = ( + prop_data["last_edited_time"] + if prop_data["last_edited_time"] + else None + ) + elif prop_type == "created_time": + value = prop_data["created_time"] if prop_data["created_time"] else None else: value = None