Entity.UpdateByUniqueAttributeAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
UpdateByUniqueAttributeAsync(String, AtlasEntityWithExtInfo, String, CancellationToken) |
Update entity partially - Allow a subset of attributes to be updated on an entity which is identified by its type and unique attribute eg: Referenceable.qualifiedName. Null updates are not possible. In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format: attr:<attrName>=<attrValue>. NOTE: The attrName and attrValue should be unique across entities, eg. qualifiedName. The REST request would look something like this: PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. |
UpdateByUniqueAttributeAsync(String, RequestContent, String, RequestContext) |
[Protocol Method] Update entity partially - Allow a subset of attributes to be updated on an entity which is identified by its type and unique attribute eg: Referenceable.qualifiedName. Null updates are not possible. In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format: attr:<attrName>=<attrValue>. NOTE: The attrName and attrValue should be unique across entities, eg. qualifiedName. The REST request would look something like this: PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue.
|
UpdateByUniqueAttributeAsync(String, AtlasEntityWithExtInfo, String, CancellationToken)
- Source:
- Entity.cs
Update entity partially - Allow a subset of attributes to be updated on an entity which is identified by its type and unique attribute eg: Referenceable.qualifiedName. Null updates are not possible.
In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format:
attr:<attrName>=<attrValue>. NOTE: The attrName and attrValue should be unique across entities, eg. qualifiedName.
The REST request would look something like this: PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult>> UpdateByUniqueAttributeAsync (string typeName, Azure.Analytics.Purview.DataMap.AtlasEntityWithExtInfo atlasEntityWithExtInfo, string attribute = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UpdateByUniqueAttributeAsync : string * Azure.Analytics.Purview.DataMap.AtlasEntityWithExtInfo * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult>>
override this.UpdateByUniqueAttributeAsync : string * Azure.Analytics.Purview.DataMap.AtlasEntityWithExtInfo * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult>>
Public Overridable Function UpdateByUniqueAttributeAsync (typeName As String, atlasEntityWithExtInfo As AtlasEntityWithExtInfo, Optional attribute As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of EntityMutationResult))
Parameters
- typeName
- String
The name of the type.
- atlasEntityWithExtInfo
- AtlasEntityWithExtInfo
An instance of an entity along with extended info - like hive_table, hive_database.
- attribute
- String
The qualified name of the entity. (This is only an example. qualifiedName can be changed to other unique attributes)
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
typeName
or atlasEntityWithExtInfo
is null.
typeName
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call UpdateByUniqueAttributeAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
AtlasEntityWithExtInfo atlasEntityWithExtInfo = new AtlasEntityWithExtInfo();
Response<EntityMutationResult> response = await client.UpdateByUniqueAttributeAsync("<typeName>", atlasEntityWithExtInfo);
This sample shows how to call UpdateByUniqueAttributeAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
AtlasEntityWithExtInfo atlasEntityWithExtInfo = new AtlasEntityWithExtInfo
{
ReferredEntities =
{
["key"] = new AtlasEntity
{
Attributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
TypeName = "<typeName>",
LastModifiedTS = "<lastModifiedTS>",
BusinessAttributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
Classifications = {new AtlasClassification
{
Attributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
TypeName = "<typeName>",
LastModifiedTS = "<lastModifiedTS>",
EntityGuid = "<entityGuid>",
EntityStatus = EntityStatus.Active,
RemovePropagationsOnEntityDelete = true,
ValidityPeriods = {new TimeBoundary
{
EndTime = "<endTime>",
StartTime = "<startTime>",
TimeZone = "<timeZone>",
}},
}},
CreateTime = 1234L,
CreatedBy = "<createdBy>",
CustomAttributes =
{
["key"] = "<customAttributes>"
},
Guid = "<guid>",
HomeId = "<homeId>",
IsIncomplete = true,
Labels = {"<labels>"},
Meanings = {new AtlasTermAssignmentHeader
{
Confidence = 1234,
CreatedBy = "<createdBy>",
Description = "<description>",
DisplayText = "<displayText>",
Expression = "<expression>",
RelationGuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"),
Status = AtlasTermAssignmentStatus.Discovered,
Steward = "<steward>",
TermGuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"),
}},
ProvenanceType = 1234,
Proxy = true,
RelationshipAttributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
Status = EntityStatus.Active,
UpdateTime = 1234L,
UpdatedBy = "<updatedBy>",
Version = 1234L,
Contacts =
{
["key"] = {new ContactInfo
{
Id = "<id>",
Info = "<info>",
}}
},
}
},
Entity = default,
};
Response<EntityMutationResult> response = await client.UpdateByUniqueAttributeAsync("<typeName>", atlasEntityWithExtInfo, attribute: "<attribute>");
Applies to
UpdateByUniqueAttributeAsync(String, RequestContent, String, RequestContext)
- Source:
- Entity.cs
[Protocol Method] Update entity partially - Allow a subset of attributes to be updated on an entity which is identified by its type and unique attribute eg: Referenceable.qualifiedName. Null updates are not possible.
In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format:
attr:<attrName>=<attrValue>. NOTE: The attrName and attrValue should be unique across entities, eg. qualifiedName.
The REST request would look something like this: PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler UpdateByUniqueAttributeAsync(String, AtlasEntityWithExtInfo, String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> UpdateByUniqueAttributeAsync (string typeName, Azure.Core.RequestContent content, string attribute = default, Azure.RequestContext context = default);
abstract member UpdateByUniqueAttributeAsync : string * Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.UpdateByUniqueAttributeAsync : string * Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function UpdateByUniqueAttributeAsync (typeName As String, content As RequestContent, Optional attribute As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- typeName
- String
The name of the type.
- content
- RequestContent
The content to send as the body of the request.
- attribute
- String
The qualified name of the entity. (This is only an example. qualifiedName can be changed to other unique attributes)
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
typeName
or content
is null.
typeName
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call UpdateByUniqueAttributeAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
using RequestContent content = RequestContent.Create(new object());
Response response = await client.UpdateByUniqueAttributeAsync("<typeName>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call UpdateByUniqueAttributeAsync with all parameters and request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
using RequestContent content = RequestContent.Create(new
{
referredEntities = new
{
key = new
{
attributes = new
{
key = new object(),
},
typeName = "<typeName>",
lastModifiedTS = "<lastModifiedTS>",
businessAttributes = new
{
key = new object(),
},
classifications = new object[]
{
new
{
attributes = new
{
key = new object(),
},
typeName = "<typeName>",
lastModifiedTS = "<lastModifiedTS>",
entityGuid = "<entityGuid>",
entityStatus = "ACTIVE",
removePropagationsOnEntityDelete = true,
validityPeriods = new object[]
{
new
{
endTime = "<endTime>",
startTime = "<startTime>",
timeZone = "<timeZone>",
}
},
}
},
createTime = 1234L,
createdBy = "<createdBy>",
customAttributes = new
{
key = "<customAttributes>",
},
guid = "<guid>",
homeId = "<homeId>",
isIncomplete = true,
labels = new object[]
{
"<labels>"
},
meanings = new object[]
{
new
{
confidence = 1234,
createdBy = "<createdBy>",
description = "<description>",
displayText = "<displayText>",
expression = "<expression>",
relationGuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
status = "DISCOVERED",
steward = "<steward>",
termGuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
}
},
provenanceType = 1234,
proxy = true,
relationshipAttributes = new
{
key = new object(),
},
status = "ACTIVE",
updateTime = 1234L,
updatedBy = "<updatedBy>",
version = 1234L,
contacts = new
{
key = new object[]
{
new
{
id = "<id>",
info = "<info>",
}
},
},
},
},
});
Response response = await client.UpdateByUniqueAttributeAsync("<typeName>", content, attribute: "<attribute>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("guidAssignments").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classificationNames")[0].ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("entityGuid").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("entityStatus").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("removePropagationsOnEntityDelete").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("timeZone").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("isIncomplete").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("labels")[0].ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meaningNames")[0].ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("confidence").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("expression").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("relationGuid").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("steward").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("meanings")[0].GetProperty("termGuid").ToString());
Console.WriteLine(result.GetProperty("mutatedEntities").GetProperty("<key>")[0].GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classificationNames")[0].ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("entityGuid").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("entityStatus").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("removePropagationsOnEntityDelete").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("timeZone").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("isIncomplete").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("labels")[0].ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meaningNames")[0].ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("confidence").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("expression").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("relationGuid").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("steward").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("meanings")[0].GetProperty("termGuid").ToString());
Console.WriteLine(result.GetProperty("partialUpdatedEntities")[0].GetProperty("status").ToString());
Applies to
Azure SDK for .NET