minwook-shin / notion-database

Python bindings for Notion Database API
https://pypi.org/project/notion-database/
GNU Lesser General Public License v3.0
136 stars 12 forks source link

Retrieve databases from a page #6

Open alisongh opened 2 years ago

alisongh commented 2 years ago

Hello, I tried to use notion-database to retrieve data from my notion. My notion is a little bit complicated. The main page has several databases, each of which has several pages, and each of which has a database. I use find_all_pages to retrieve pages from the databases, but I want to know if I can retrieve databases from the pages and how. Thank you.

Here's the structure sample of my Notion database: Notion

minwook-shin commented 2 years ago
def search_database(self, query: str, sort: SortType, root_only=True):
S.search_database(query="", sort={"direction": Direction.ascending, "timestamp": Timestamp.last_edited_time}, root_only=False)

Hello. @alisongh i didn't understand problem, but give you some code! check the 'root_only' parameter of 'search_database' function. Default value is True, try changing to False.