module documentation

FiftyOne migrations runner.

Copyright 2017-2025, Voxel51, Inc.

Class MigrationRunner Class for running FiftyOne migrations.
Function get_database_revision Gets the current revision of the database.
Function get_dataset_revision Gets the current revision of the given dataset.
Function migrate_all Migrates the database and all datasets to the specified destination revision.
Function migrate_database_if_necessary Migrates the database to the specified revision, if necessary.
Function migrate_dataset_if_necessary Migrates the dataset from its current revision to the specified destination revision.
Function needs_migration Determines whether a dataset requires a migration in order to be used in the specified destination revision.
Function Version A packaging.version.Version proxy that excludes things like RC version info.
Constant DOWN Undocumented
Constant UP Undocumented
Variable logger Undocumented
Function _can_skip_migration Undocumented
Function _database_exists Undocumented
Function _get_all_revisions Undocumented
Function _get_revisions_to_run Undocumented
Function _is_compatible_version Undocumented
Function _migrate_dataset_if_necessary Undocumented
Function _migrations_disabled Undocumented
def get_database_revision(): (source)

Gets the current revision of the database.

Returns
the database revision string
def get_dataset_revision(name): (source)

Gets the current revision of the given dataset.

Parameters
namethe name of the dataset
Returns
the dataset revision string
def migrate_all(destination=None, error_level=0, verbose=False): (source)

Migrates the database and all datasets to the specified destination revision.

If fiftyone.config.database_admin is False and no destination is provided, the database and each dataset will only be migrated if their current versions are not compatible with the client's version.

Parameters
destination:Nonethe destination revision. By default, the fiftyone client version is used
error_level:0

the error level to use if an individual dataset cannot be migrated. Valid values are:

  • 0: raise error if a dataset cannot be migrated
  • 1: log warning if a dataset cannot be migrated
  • 2: ignore datasets that cannot be migrated
verbose:Falsewhether to log incremental migrations that are run
def migrate_database_if_necessary(destination=None, verbose=False, config=None): (source)

Migrates the database to the specified revision, if necessary.

If fiftyone.config.database_admin is False and no destination is provided, the database will only be migrated if its current version is not compatible with the client's version.

Parameters
destination:Nonethe destination revision. By default, the fiftyone client version is used
verbose:Falsewhether to log incremental migrations that are run
config:Nonean optional DatabaseConfigDocument. By default, DB config is pulled from the database.
def migrate_dataset_if_necessary(name, destination=None, error_level=0, verbose=False): (source)

Migrates the dataset from its current revision to the specified destination revision.

If fiftyone.config.database_admin is False and no destination is provided, the dataset will only be migrated if its current version is not compatible with the client's version.

Parameters
namethe name of the dataset
destination:Nonethe destination revision. By default, the current database version is used
error_level:0

the error level to use. Valid values are:

  • 0: raise error if the dataset cannot be migrated
  • 1: log warning if the dataset cannot be migrated
  • 2: ignore datasets that cannot be migrated
verbose:Falsewhether to log incremental migrations that are run
def needs_migration(name=None, head=None, destination=None): (source)

Determines whether a dataset requires a migration in order to be used in the specified destination revision.

To use this method, specify either the name of an existing dataset or provide the head revision of the dataset.

If fiftyone.config.database_admin is False and no destination is provided, a dataset will be deemed to require no migration if its current version if compatible with the client's version.

Parameters
name:Nonethe name of the dataset
head:Nonethe current revision of the dataset
destination:Nonethe destination revision. By default, the current database version is used
Returns
True/False
def Version(version): (source)

A packaging.version.Version proxy that excludes things like RC version info.

Undocumented

Value
'down'

Undocumented

Value
'up'

Undocumented

def _can_skip_migration(head): (source)

Undocumented

def _database_exists(): (source)

Undocumented

def _get_all_revisions(admin=False): (source)

Undocumented

def _get_revisions_to_run(head, dest, revisions): (source)

Undocumented

def _is_compatible_version(version): (source)

Undocumented

def _migrate_dataset_if_necessary(name, destination, verbose): (source)

Undocumented

def _migrations_disabled(): (source)

Undocumented