backup#

swordfish.function.backup()#

Back up all or specified partitions of a distributed table.

Parameters:
  • backupDir (Constant) – A string indicating the directory to save the backup. For an AWS S3 directory, it must begin with s3://.

  • dbPath (Union[Alias[Literal["sqlObj"]], Constant]) – A string indicating the database path. If specified, back up the database by copying partitions. If backupDir is an AWS S3 directory, only dbPath can be specified.

  • force (Constant, optional) – A Boolean value, by default DFLT. True means to perform a full backup, otherwise to perform an incremental backup.

  • parallel (Constant, optional) – A Boolean value indicating whether to back up partitions in parallel, by default DFLT.

  • snapshot (Constant, optional) – A Boolean value indicating whether to synchronize the deletion of tables/partitions to the backup database, by default DFLT. It only takes effect when the parameter partition is empty.

  • tableName (Constant, optional) – A STRING scalar or vector indicating the name of table to be backed up. If unspecified, all tables of the database are backed up, by default DFLT.

  • partition (Constant, optional) –

    Indicates the partitions to be backed up. It can be:

    • a STRING scalar or vector indicating the path(s) to one or multiple partitions of a database, and each path starts with “/”. Note that for a compo-partitioned database, the path must include all partition levels.

    • filter condition(s). A filter condition can be a scalar or vector where each element represents a partition.

      • For a single-level partitioning database, it is a scalar.

      • For a compo-partitioned database, it is a tuple composed of filter conditions with each element for a partition level. If a partition level has no filter condition, the corresponding element in the tuple is empty.

      • unspecified to indicate all partitions.

  • keyPath (Constant, optional) – A STRING scalar that specifies the path to the TDE key file used for backup encryption, by default DFLT

Returns:

An integer indicating the number of partitions that have been backed up successfully.

Return type:

Constant