backupTable

Syntax

backupTable(backupDir, dbPath, tableName, [keyPath])

Details

Back up a table to the specified directory.

The function is equivalent to backup(backupDir, dbPath, force=false, parallel=true, snapshot=true, tableName).

Parameters

backupDir is a string indicating the directory to save the backup.

dbPath is a string indicating the database path.

tableName is a string indicating the table name.

keyPath (optional, Linux only) is a STRING scalar that specifies the path to the TDE key file used for backup encryption. If left empty, no encryption will be applied.

Return

An INT scalar, indicating the number of tables that were backed up.

Examples

dbName = "dfs://compoDB2"
n=1000
ID=rand("a"+string(1..10), n)
dates=2017.08.07..2017.08.11
date=rand(dates, n)
x=rand(10, n)
t=table(ID, date, x)
db1 = database(, VALUE, 2017.08.07..2017.08.11)
db2 = database(, HASH,[INT, 20])
if(existsDatabase(dbName)){
  dropDatabase(dbName)
}
db = database(dbName, COMPO,[ db1,db2])

//create 2 tables
pt1 = db.createPartitionedTable(t, `pt1, `date`x).append!(t)
pt2 = db.createPartitionedTable(t, `pt2, `date`x).append!(t)

backupTable(backupDir,dbName,`pt1)
// output: 50

Related functions: backup, backupDB, restore, restoreDB, restoreTable, migrate