How to delete a layer
How to delete a layer
To delete a layer, use the deleteLayer method of AdminApi provided by the
data-client module. You have to pass the catalog's HRN to which a layer
belongs and the layer ID:
val layerId = "layer-3"
adminApi.deleteLayer(catalogHrn, layerId).flatMap { _ =>
log.info(s"deleted $layerId from $catalogHrn")
Future.successful(catalogHrn)
}String layerId = "layer-2";
CompletionStage<CompletionStage<HRN>> layerDeletionStage =
adminApi
.deleteLayer(catalogHrn, layerId)
.thenApply(
done -> {
log.info("deleted `" + layerId + "` from catalog`" + catalogHrn + "`");
CompletableFuture<HRN> retval = new CompletableFuture<HRN>();
retval.complete(catalogHrn);
return retval;
});
WarningData loss
Once a layer is deleted, all the associated data and metadata is also deleted. There is no mechanism to undo the operation. Therefore, this should be done with caution.
You can delete volatile, stream and index layers.
NoteDeletion of Versioned Layers
You cannot delete versioned layers. If you try to delete a versioned layer, aDataClientExceptionwill be thrown.
Updated 22 days ago