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

EmptyDBError

A special exception that tells us that a database is empty during probing.

EndsWith

is_method: bool = True class-attribute instance-attribute

Equals

__repr__() -> str

create_obj_ref(db: Database) -> obj_query.QueryFilter

EqualsNot

__repr__() -> str

FilterQueryError

An exception that is raised when a filter query is invalid.

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) -> Equals

__ge__(value: Any) -> GreaterThanOrEqualTo

__gt__(value: Any) -> GreaterThan

__hash__() -> int

__le__(value: Any) -> LessThanOrEqualTo

__lt__(value: Any) -> LessThan

__ne__(other: Any) -> EqualsNot

__repr__() -> str

__str__() -> str

asc() -> Self

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

desc() -> Self

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

ends_with(value: str) -> EndsWith

is_empty() -> IsEmpty

is_not_empty() -> IsNotEmpty

next_month() -> NextMonth

next_week() -> NextWeek

next_year() -> NextYear

past_month() -> PastMonth

past_week() -> PastWeek

past_year() -> PastYear

starts_with(value: str) -> StartsWith

this_week() -> ThisWeek

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.