Skip to content

A few questions about extracting pages from the database #69

Answered by lastorel
defnone asked this question in Q&A
Discussion options

You must be logged in to vote
  1. You can use no.databases.db_query("DATABASE_ID") method. It returns the PageArray with all pages, which includes all attributes.
no = Notion(token=...)
pages = no.databases.db_query("DATABASE_ID")
# here is a list of pages
print(pages.obj)
print(pages.obj[0])
print(pages.obj[0].title)
print(pages.obj[0].properties["ATTRIBUTE_NAME"])
print(pages.obj[0].properties["ATTRIBUTE_NAME"].value)
  1. Use
db = no.databases.get("DATABASE_ID")
db.db_filter(property_name="Status", property_type="status", value="in progress")

It will return the same type - Element with PageArray as in the example above

  1. It was possible only for a specific database (not for all available databases) and relative to a spec…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by defnone
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants