restoreTable(backupDir, dbPath, tableName, [newDBPath], [newTableName])


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.

newDBPath (optional) is a string indicating the new database name. The default value is dbPath.

newTableName (optional) is a string indicating the new table name. The default value is tableName.


Restore the backup database. Return a table where each row is the restored database and table name. The function is equivalent to restore(backupDir, dbPath, tableName, force=false, parallel=true, snapshot=true).

Similar to function migrate, the function can restore all tables of a database, and the difference lies in:

  • migrate can restore all databases and tables under a directory, while restoreTable can only restore a table.

  • When the names of restored database and tables are the same as the originals, the original database and tables must be deleted before calling migrate, which is not required by function restoreTable.


  • This function can only restore a database backed up by copying files (when dbPath is specified for function backup).

  • Make sure that the storage engine of the backed-up database is the same as the engine of newDBPath, and the partitionScheme (except for VALUE) must be the same. For a VALUE partitioned database, the partitioning scheme of the backup database must be a subset of that of the database to be restored.


dbName = "dfs://compoDB2"
ID=rand("a"+string(1..10), n)
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])
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)

backupDB(backupDir, dbName)

dbName tableName
dfs://compoDB2 pt1

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