Transaction#

class beets.dbcore.db.Transaction(db: Database)[source]#

Bases: object

A context manager for safe, concurrent access to the database. All SQL commands should be executed through a transaction.

__init__(db: Database)[source]#

Public methods summary

mutate(statement[, subvals])

Execute an SQL statement with substitution values and return the row ID of the last affected row.

query(statement[, subvals])

Execute an SQL statement with substitution values and return a list of rows from the database.

script(statements)

Execute a string containing multiple SQL statements.

Methods definition

mutate(statement: str, subvals: Sequence[SQLiteType] = ()) Any[source]#

Execute an SQL statement with substitution values and return the row ID of the last affected row.

query(statement: str, subvals: Sequence[SQLiteType] = ()) list[sqlite3.Row][source]#

Execute an SQL statement with substitution values and return a list of rows from the database.

script(statements: str)[source]#

Execute a string containing multiple SQL statements.