restore_table_from_cluster_snapshot
(**kwargs)¶Creates a new table from a table in an Amazon Redshift cluster snapshot. You must create the new table within the Amazon Redshift cluster that the snapshot was taken from.
You cannot use RestoreTableFromClusterSnapshot
to restore a table with the same name as an existing table in an Amazon Redshift cluster. That is, you cannot overwrite an existing table in a cluster with a restored table. If you want to replace your original table with a new, restored table, then rename or drop your original table before you call RestoreTableFromClusterSnapshot
. When you have renamed your original table, then you can pass the original name of the table as the NewTableName
parameter value in the call to RestoreTableFromClusterSnapshot
. This way, you can replace the original table with the table created from the snapshot.
You can't use this operation to restore tables with interleaved sort keys.
See also: AWS API Documentation
Request Syntax
response = client.restore_table_from_cluster_snapshot(
ClusterIdentifier='string',
SnapshotIdentifier='string',
SourceDatabaseName='string',
SourceSchemaName='string',
SourceTableName='string',
TargetDatabaseName='string',
TargetSchemaName='string',
NewTableName='string',
EnableCaseSensitiveIdentifier=True|False
)
[REQUIRED]
The identifier of the Amazon Redshift cluster to restore the table to.
[REQUIRED]
The identifier of the snapshot to restore the table from. This snapshot must have been created from the Amazon Redshift cluster specified by the ClusterIdentifier
parameter.
[REQUIRED]
The name of the source database that contains the table to restore from.
SourceSchemaName
value, the default is public
.[REQUIRED]
The name of the source table to restore from.
[REQUIRED]
The name of the table to create as a result of the current request.
true
, the names are case sensitive. If false
(default), the names are not case sensitive.dict
Response Syntax
{
'TableRestoreStatus': {
'TableRestoreRequestId': 'string',
'Status': 'PENDING'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'CANCELED',
'Message': 'string',
'RequestTime': datetime(2015, 1, 1),
'ProgressInMegaBytes': 123,
'TotalDataInMegaBytes': 123,
'ClusterIdentifier': 'string',
'SnapshotIdentifier': 'string',
'SourceDatabaseName': 'string',
'SourceSchemaName': 'string',
'SourceTableName': 'string',
'TargetDatabaseName': 'string',
'TargetSchemaName': 'string',
'NewTableName': 'string'
}
}
Response Structure
(dict) --
TableRestoreStatus (dict) --
Describes the status of a RestoreTableFromClusterSnapshot operation.
TableRestoreRequestId (string) --
The unique identifier for the table restore request.
Status (string) --
A value that describes the current state of the table restore request.
Valid Values: SUCCEEDED
, FAILED
, CANCELED
, PENDING
, IN_PROGRESS
Message (string) --
A description of the status of the table restore request. Status values include SUCCEEDED
, FAILED
, CANCELED
, PENDING
, IN_PROGRESS
.
RequestTime (datetime) --
The time that the table restore request was made, in Universal Coordinated Time (UTC).
ProgressInMegaBytes (integer) --
The amount of data restored to the new table so far, in megabytes (MB).
TotalDataInMegaBytes (integer) --
The total amount of data to restore to the new table, in megabytes (MB).
ClusterIdentifier (string) --
The identifier of the Amazon Redshift cluster that the table is being restored to.
SnapshotIdentifier (string) --
The identifier of the snapshot that the table is being restored from.
SourceDatabaseName (string) --
The name of the source database that contains the table being restored.
SourceSchemaName (string) --
The name of the source schema that contains the table being restored.
SourceTableName (string) --
The name of the source table being restored.
TargetDatabaseName (string) --
The name of the database to restore the table to.
TargetSchemaName (string) --
The name of the schema to restore the table to.
NewTableName (string) --
The name of the table to create as a result of the table restore request.
Exceptions
Redshift.Client.exceptions.ClusterSnapshotNotFoundFault
Redshift.Client.exceptions.InProgressTableRestoreQuotaExceededFault
Redshift.Client.exceptions.InvalidClusterSnapshotStateFault
Redshift.Client.exceptions.InvalidTableRestoreArgumentFault
Redshift.Client.exceptions.ClusterNotFoundFault
Redshift.Client.exceptions.InvalidClusterStateFault
Redshift.Client.exceptions.UnsupportedOperationFault