Data deletion service (gRPC)#
Data Deletion Service manages deletion of stored data.
Endpoints#
Delete data#
gRPC /nominal.storage.v1.DataDeletionService/DeleteData
Do not use it for new integrations.
Deletes stored data. This is an irreversible operation so be careful about specified time range, channel names, and tag scope. requires the user to be an admin for the organization.
Request: DeleteDataRequest
data_source_ridstring
time_rangeRangeIf specified, will only delete data within the given time range. If not specified, will delete data across all time.
tagsmap of string to stringIf specified, will only delete data that fully matches the given tags. If not specified, will delete data across all tags.
channel_namesarray of stringIf specified, will only delete data that has an exact channel name match with the given names. If not specified, will delete data across all channels.
delete_metadatabooleanIf true and tags, channelNames, and timeRange are empty, will also delete associated channel metadata. Otherwise, will only delete raw data. This is to guarantee that you are not orphaning data unintentionally by deleting the metadata.
Response: DeleteDataResponse
A message with no fields.
Request
import grpc
from nominal.protos.storage.v1 import data_deletion_pb2, data_deletion_pb2_grpc
channel = grpc.secure_channel("api.gov.nominal.io:443", grpc.ssl_channel_credentials())
data_deletion_service = data_deletion_pb2_grpc.DataDeletionServiceStub(channel)
auth = [("authorization", "Bearer <api key>")]
request = data_deletion_pb2.DeleteDataRequest(
data_source_rid="<data source rid>",
time_range={"start": {"seconds": 1, "nanos": 1}, "end": {"seconds": 1, "nanos": 1}},
tags={"<key>": "<value>"},
channel_names=["<channel names>"],
delete_metadata=True,
)
response = data_deletion_service.DeleteData(request, metadata=auth)
print(response)
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
storagev1 "github.com/nominal-io/nominal-api-protos-go/nominal/protos/storage/v1"
typestime "github.com/nominal-io/nominal-api-protos-go/nominal/protos/types/time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/proto"
)
func main() {
conn, err := grpc.NewClient("api.gov.nominal.io:443",
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
if err != nil {
log.Fatal(err)
}
defer conn.Close()
dataDeletionService := storagev1.NewDataDeletionServiceClient(conn)
ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer <api key>")
request := &storagev1.DeleteDataRequest{
DataSourceRid: "<data source rid>",
TimeRange: &typestime.Range{
Start: &typestime.Timestamp{
Seconds: proto.Int64(1),
Nanos: proto.Int64(1),
},
End: &typestime.Timestamp{
Seconds: proto.Int64(1),
Nanos: proto.Int64(1),
},
},
Tags: map[string]string{
"<key>": "<value>",
},
ChannelNames: []string{
"<channel names>",
},
DeleteMetadata: true,
}
response, err := dataDeletionService.DeleteData(ctx, request)
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
Response
{}
Types#
Range#
Deprecated for new APIs. Define an API-owned range with the endpoint semantics it needs instead.
Timestamp#
Deprecated for new APIs. Use google.protobuf.Timestamp for absolute instants.
This legacy nanosecond-precision timestamp is represented by an epoch time in seconds and a nanosecond offset. The nanosecond offset is from the start of the epoch second, so must be less than 1 billion.
secondsinteger (int64)
nanosinteger (int64)
Page design based on Scalar, MIT License.