Bamboost

bamboost.index.versioning

Attributes

  • MigrationExecutor=collections.abc.Callable[[pathlib.Path, pathlib.Path, bool | None], None]
  • _MIGRATIONS:dict[tuple[Version, bamboost.index.versioning.Version], bamboost.index.versioning.MigrationExecutor]={}

Functions

migrate_database(from_version, to_version, *, source_db=None, destination_db=None, update=False) -> None

Migrate the index database between two schema versions.

Arguments:
  • from_version:Version

    The source version.

  • to_version:Version

    The destination version.

  • source_db:pathlib.Path | None=None

    Optional path to the source database file. If not provided, it will be determined from the config.

  • destination_db:pathlib.Path | None=None

    Optional path to the destination database file. If not provided, it will be determined from the config.

  • update:bool=False

    If True, existing records in the destination will be updated with values from the source. Otherwise, existing records will be left unchanged.

_register_migration(from_version, to_version) -> Callable[[MigrationExecutor], MigrationExecutor]

Decorator to register a migration executor for a version pair.

Arguments:
_get_migration(from_version, to_version) -> MigrationExecutor

Return the migration function or raise.

Arguments:
_migrate_v0_10_to_v0_11(source_db, destination_db, *, update=False) -> None

Migrate database content from version 0.10 to 0.11.

If update=True, existing records in the destination are updated with values from the source.

Arguments:
  • source_db:pathlib.Path
  • destination_db:pathlib.Path
  • update:bool=False

Classes

Version

Version(self, version, database_file_name)
Arguments:
  • version:str
  • database_file_name:str
Attributes:
  • V0_10=('0.10', 'bamboost-next.sqlite')
  • V0_11=('0.11', 'bamboost.0.11.sqlite')
  • version=bamboost.index.versioning.Version(version)
  • database_file_name=bamboost.index.versioning.Version(database_file_name)
Version.__str__(self) -> str
Version.latest(cls) -> 'Version'

Return the latest version.

Arguments:
  • cls
Version.from_str(cls, version_str) -> 'Version'

Get enum member by version string.

Arguments:
  • cls
  • version_str:str

MigrationError

Base class for migration-related errors.

MigrationNotAvailableError

MigrationNotAvailableError(self, from_version, to_version) -> None

Raised when no migration routine is registered for a version pair.

Arguments:

SourceDatabaseNotFoundError

SourceDatabaseNotFoundError(self, source_path) -> None

Raised when the source database file cannot be located.

Arguments:
  • source_path:pathlib.Path
Attributes:
  • source_path=bamboost.index.versioning.SourceDatabaseNotFoundError(source_path)

On this page