weaviate.backup

Module for backup/restore operations

class weaviate.backup.Backup(connection: weaviate.connect.connection.Connection)

Bases: object

Backup class used to schedule and/or check the status of a backup process of Weaviate objects.

Initialize a Classification class instance.

Parameters

connection (weaviate.connect.Connection) – Connection object to an active and running Weaviate instance.

create(backup_id: str, backend: str, include_classes: Optional[Union[List[str], str]] = None, exclude_classes: Optional[Union[List[str], str]] = None, wait_for_completion: bool = False) dict

Create a backup of all/per class Weaviate objects.

Parameters
  • backup_id (str) – The identifier name of the backup. NOTE: Case insensitive.

  • backend (str) –

    The backend storage where to create the backup. Currently available options are:

    ”filesystem”, “s3” and “gsc”.

    NOTE: Case insensitive.

  • include_classes (Union[List[str], str, None], optional) – The class/list of classes to be included in the backup. If not specified all classes will be included. Either include_classes or exclude_classes can be set. By default None.

  • exclude_classes (Union[List[str], str, None], optional) – The class/list of classes to be excluded in the backup. Either include_classes or exclude_classes can be set. By default None.

  • wait_for_completion (bool, optional) – Whether to wait until the backup is done. By default False.

Returns

Backup creation response.

Return type

dict

Raises
  • requests.ConnectionError – If the network connection to weaviate fails.

  • weaviate.UnexpectedStatusCodeException – If weaviate reports a none OK status.

  • TypeError – One of the arguments have a wrong type.

  • ValueError – ‘backend’ does not have an accepted value.

get_create_status(backup_id: str, backend: str) bool

Checks if a started classification job has completed.

Parameters
  • backup_id (str) – The identifier name of the backup. NOTE: Case insensitive.

  • backend (str) –

    The backend storage where the backup was created. Currently available options are:

    ”filesystem”, “s3” and “gsc”.

    NOTE: Case insensitive.

Returns

Status of the backup create.

Return type

dict

get_restore_status(backup_id: str, backend: str) bool

Checks if a started classification job has completed.

Parameters
  • backup_id (str) – The identifier name of the backup. NOTE: Case insensitive.

  • backend (str) –

    The backend storage where to create the backup. Currently available options are:

    ”filesystem”, “s3” and “gsc”.

    NOTE: Case insensitive.

Returns

Status of the backup create.

Return type

dict

restore(backup_id: str, backend: str, include_classes: Optional[Union[List[str], str]] = None, exclude_classes: Optional[Union[List[str], str]] = None, wait_for_completion: bool = False) dict

Restore a backup of all/per class Weaviate objects.

Parameters
  • backup_id (str) – The identifier name of the backup. NOTE: Case insensitive.

  • backend (str) –

    The backend storage from where to restore the backup. Currently available options are:

    ”filesystem”, “s3” and “gsc”.

    NOTE: Case insensitive.

  • include_classes (Union[List[str], str, None], optional) – The class/list of classes to be included in the backup restore. If not specified all classes will be included (that were backup-ed). Either include_classes or exclude_classes can be set. By default None.

  • exclude_classes (Union[List[str], str, None], optional) – The class/list of classes to be excluded in the backup restore. Either include_classes or exclude_classes can be set. By default None.

  • wait_for_completion (bool, optional) – Whether to wait until the backup restore is done.

Returns

Backup restore response.

Return type

dict

Raises