2025-12-16 21:31:36 -08:00
|
|
|
import sqlite3
|
|
|
|
|
|
|
|
|
|
import click
|
2023-07-22 12:04:31 -07:00
|
|
|
from pluggy import HookimplMarker
|
|
|
|
|
from pluggy import HookspecMarker
|
|
|
|
|
|
|
|
|
|
hookspec = HookspecMarker("sqlite_utils")
|
|
|
|
|
hookimpl = HookimplMarker("sqlite_utils")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@hookspec
|
2025-12-16 21:31:36 -08:00
|
|
|
def register_commands(cli: click.Group) -> None:
|
2023-07-22 12:04:31 -07:00
|
|
|
"""Register additional CLI commands, e.g. 'sqlite-utils mycommand ...'"""
|
2023-07-22 15:59:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@hookspec
|
2025-12-16 21:31:36 -08:00
|
|
|
def prepare_connection(conn: sqlite3.Connection) -> None:
|
2023-07-22 15:59:08 -07:00
|
|
|
"""Modify SQLite connection in some way e.g. register custom SQL functions"""
|