Query
query
¶
Query the database for pages.
And
¶
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
¶
DateCondition
¶
EmptyDBError
¶
A special exception that tells us that a database is empty during probing.
FilterQueryError
¶
An exception that is raised when a filter query is invalid.
InEquality
¶
IsEmpty
¶
NextMonth
¶
NextWeek
¶
NextYear
¶
Or
¶
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
¶
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
¶
StartsWith
¶
ThisWeek
¶
prop(prop_name: str) -> Property
¶
Create a property object.