Entity.BatchCreateOrUpdate 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
BatchCreateOrUpdate(AtlasEntitiesWithExtInfo, String, Nullable<BusinessAttributeUpdateBehavior>, CancellationToken) |
Create or update entities in bulk. Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. For each contact type, the maximum number of contacts is 20. |
BatchCreateOrUpdate(RequestContent, String, String, RequestContext) |
[Protocol Method] Create or update entities in bulk. Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. For each contact type, the maximum number of contacts is 20.
|
BatchCreateOrUpdate(AtlasEntitiesWithExtInfo, String, Nullable<BusinessAttributeUpdateBehavior>, CancellationToken)
- Source:
- Entity.cs
Create or update entities in bulk. Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. For each contact type, the maximum number of contacts is 20.
public virtual Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult> BatchCreateOrUpdate (Azure.Analytics.Purview.DataMap.AtlasEntitiesWithExtInfo atlasEntitiesWithExtInfo, string collectionId = default, Azure.Analytics.Purview.DataMap.BusinessAttributeUpdateBehavior? businessAttributeUpdateBehavior = default, System.Threading.CancellationToken cancellationToken = default);
abstract member BatchCreateOrUpdate : Azure.Analytics.Purview.DataMap.AtlasEntitiesWithExtInfo * string * Nullable<Azure.Analytics.Purview.DataMap.BusinessAttributeUpdateBehavior> * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult>
override this.BatchCreateOrUpdate : Azure.Analytics.Purview.DataMap.AtlasEntitiesWithExtInfo * string * Nullable<Azure.Analytics.Purview.DataMap.BusinessAttributeUpdateBehavior> * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.EntityMutationResult>
Public Overridable Function BatchCreateOrUpdate (atlasEntitiesWithExtInfo As AtlasEntitiesWithExtInfo, Optional collectionId As String = Nothing, Optional businessAttributeUpdateBehavior As Nullable(Of BusinessAttributeUpdateBehavior) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of EntityMutationResult)
Parameters
- atlasEntitiesWithExtInfo
- AtlasEntitiesWithExtInfo
An instance of an entity along with extended info - like hive_table, hive_database.
- collectionId
- String
The collection where entities will be moved to. Only specify a value if you need to move an entity to another collection.
- businessAttributeUpdateBehavior
- Nullable<BusinessAttributeUpdateBehavior>
Used to define the update behavior for business attributes when updating entities.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
atlasEntitiesWithExtInfo
is null.
Examples
This sample shows how to call BatchCreateOrUpdate.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
AtlasEntitiesWithExtInfo atlasEntitiesWithExtInfo = new AtlasEntitiesWithExtInfo();
Response<EntityMutationResult> response = client.BatchCreateOrUpdate(atlasEntitiesWithExtInfo);
This sample shows how to call BatchCreateOrUpdate with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient(apiVersion: "2023-09-01");
AtlasEntitiesWithExtInfo atlasEntitiesWithExtInfo = new AtlasEntitiesWithExtInfo
{
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>",
}}
},
}
},
Entities = { default },
};
Response<EntityMutationResult> response = client.BatchCreateOrUpdate(atlasEntitiesWithExtInfo, collectionId: "<collectionId>", businessAttributeUpdateBehavior: BusinessAttributeUpdateBehavior.Ignore);
Applies to
BatchCreateOrUpdate(RequestContent, String, String, RequestContext)
- Source:
- Entity.cs
[Protocol Method] Create or update entities in bulk. Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. For each contact type, the maximum number of contacts is 20.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler BatchCreateOrUpdate(AtlasEntitiesWithExtInfo, String, Nullable<BusinessAttributeUpdateBehavior>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response BatchCreateOrUpdate (Azure.Core.RequestContent content, string collectionId = default, string businessAttributeUpdateBehavior = default, Azure.RequestContext context = default);
abstract member BatchCreateOrUpdate : Azure.Core.RequestContent * string * string * Azure.RequestContext -> Azure.Response
override this.BatchCreateOrUpdate : Azure.Core.RequestContent * string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function BatchCreateOrUpdate (content As RequestContent, Optional collectionId As String = Nothing, Optional businessAttributeUpdateBehavior As String = Nothing, Optional context As RequestContext = Nothing) As Response
Parameters
- content
- RequestContent
The content to send as the body of the request.
- collectionId
- String
The collection where entities will be moved to. Only specify a value if you need to move an entity to another collection.
- businessAttributeUpdateBehavior
- String
Used to define the update behavior for business attributes when updating entities. Allowed values: "ignore" | "replace" | "merge"
- 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
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call BatchCreateOrUpdate 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 = client.BatchCreateOrUpdate(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call BatchCreateOrUpdate 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(apiVersion: "2023-09-01");
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>",
}
},
},
},
},
entities = new object[]
{
null
},
});
Response response = client.BatchCreateOrUpdate(content, collectionId: "<collectionId>", businessAttributeUpdateBehavior: "ignore");
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