Query#

class beets.dbcore.query.Query[source]#

Bases: ABC

An abstract class representing a query into the database.

__init__()#

Public methods summary

clause()

Generate an SQLite expression implementing the query.

match(obj)

Check whether this query matches a given Model.

Methods definition

abstract clause() tuple[str | None, Sequence[Any]][source]#

Generate an SQLite expression implementing the query.

Return (clause, subvals) where clause is a valid sqlite WHERE clause implementing the query and subvals is a list of items to be substituted for ?s in the clause.

The default implementation returns None, falling back to a slow query using match().

property field_names: set[str]#

Return a set with field names that this query operates on.

abstract match(obj: Model)[source]#

Check whether this query matches a given Model. Can be used to perform queries on arbitrary sets of Model.