jdxi_editor.core.db.connection

This module provides a utility class DatabaseConnection that offers a structured approach for handling SQLite database interactions. It includes features such as ensuring database directories exist, managing SQLite connections, and executing multiple SQL statements transactionally.

Classes:

DatabaseConnection: A wrapper for managing SQLite database connections.

Classes

DatabaseConnection

A wrapper class for managing SQLite database connections.

Module Contents

class jdxi_editor.core.db.connection.DatabaseConnection(db_path: pathlib.Path)[source]

A wrapper class for managing SQLite database connections.

db_path[source]
_ensure_parent_directory_exists()[source]

Ensure the parent directory of the database file exists.

get_connection() sqlite3.Connection[source]

Get a SQLite connection with proper settings.

get_connection_context()[source]

Context manager for SQLite connection with autocommit and pragmas.

execute_multiple(sql_statements: List[str])[source]

Execute multiple SQL statements within a transaction.

Parameters:

sql_statements – List of SQL statements to execute.