Skip to content

Query

query

Query the database for pages.

And

terms: list[Condition] instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

Condition

Base class for filter query conditions.

is_method: bool = False class-attribute instance-attribute

__and__(other: Condition) -> Condition

__iand__(other: Condition) -> Condition

__ior__(other: Condition) -> Condition

__or__(other: Condition) -> Condition

__repr__() -> str abstractmethod

__str__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter abstractmethod

Contains

is_method: bool = True class-attribute instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

ContainsNot

is_method: bool = True class-attribute instance-attribute

DateCondition

is_method: bool = True class-attribute instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

EndsWith

is_method: bool = True class-attribute instance-attribute

Equals

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

EqualsNot

__repr__() -> str

GreaterThan

__repr__() -> str

GreaterThanOrEqualTo

__repr__() -> str

InEquality

__repr__() -> str abstractmethod

create_obj_ref(db: Database) -> obj_query.QueryFilter

IsEmpty

is_method: bool = True class-attribute instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

IsNotEmpty

is_method: bool = True class-attribute instance-attribute

LessThan

__repr__() -> str

LessThanOrEqualTo

__repr__() -> str

NextMonth

NextWeek

NextYear

Or

terms: list[Condition] instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

PastMonth

PastWeek

PastYear

Property

Represents a property of a page.

Note

We override some magic methods to allow for more natural query building in an unorthodox way. Be aware that for instance the comparison operator == will not return boolean values but instances of the corresponding condition classes.

any: RollupArrayProperty property

every: RollupArrayProperty property

name: str instance-attribute

none: RollupArrayProperty property

sort: SortDirection = Field(default=SortDirection.ASCENDING) class-attribute instance-attribute

__eq__(other: Any) -> Condition

__ge__(value: Any) -> Condition

__gt__(value: Any) -> Condition

__hash__() -> int

__le__(value: Any) -> Condition

__lt__(value: Any) -> Condition

__ne__(other: Any) -> Condition

__repr__() -> str

__str__() -> str

asc() -> Self

contains(value: str | User | Page | Option) -> Condition

desc() -> Self

does_not_contain(value: str | User | Page | Option) -> Condition

ends_with(value: str) -> Condition

is_empty() -> Condition

is_not_empty() -> Condition

next_month() -> Condition

next_week() -> Condition

next_year() -> Condition

past_month() -> Condition

past_week() -> Condition

past_year() -> Condition

starts_with(value: str) -> Condition

this_week() -> Condition

PropertyCondition

prop: Property instance-attribute

value: Any instance-attribute

Query(database: Database)

A query object to filter and sort pages in a database.

database: Database = database instance-attribute

__repr__() -> str

__str__() -> str

execute() -> View

Execute the query and return the resulting pages as a view.

filter(expr: Condition) -> Query

Filter the query by the given properties.

Note

The filter is applied as an AND operation with the existing filter.

sort(*props: Property | str) -> Query

Sort the query by the given properties and directions.

Note

The order of the properties is important. The first property is the primary sort, the second is the secondary sort, and so on. Calling this method multiple times will overwrite the previous sorts.

RollupArrayProperty

Represents a rollup array property of a page.

quantifier: ArrayQuantifier instance-attribute

__repr__() -> str

StartsWith

is_method: bool = True class-attribute instance-attribute

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

ThisWeek

prop(prop_name: str) -> Property

Create a property object.