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
| Name | Description |
|---|---|
| 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 body, 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 (body As AtlasEntitiesWithExtInfo, Optional collectionId As String = Nothing, Optional businessAttributeUpdateBehavior As Nullable(Of BusinessAttributeUpdateBehavior) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of EntityMutationResult)
Parameters
Body parameter.
- 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
body is null.
Examples
This sample shows how to call BatchCreateOrUpdate.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
AtlasEntitiesWithExtInfo body = new AtlasEntitiesWithExtInfo
{
ReferredEntities = { },
Entities = {new AtlasEntity
{
Attributes =
{
["owner"] = BinaryData.FromObjectAsJson("ExampleOwner"),
["modifiedTime"] = BinaryData.FromObjectAsJson(0),
["createTime"] = BinaryData.FromObjectAsJson(0),
["qualifiedName"] = BinaryData.FromObjectAsJson("exampleaccount1"),
["name"] = BinaryData.FromObjectAsJson("ExampleStorageAccount1"),
["description"] = null,
["publicAccessLevel"] = null
},
TypeName = "azure_storage_account",
CreatedBy = "ExampleCreator",
Status = EntityStatus.Active,
UpdatedBy = "ExampleUpdator",
Version = 0L,
Contacts =
{
["Expert"] = new ContactInfo[]
{
new ContactInfo
{
Id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
Info = "Example Expert Info",
}
},
["Owner"] = new ContactInfo[]
{
new ContactInfo
{
Id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
Info = "Example Owner Info",
}
}
},
}, new AtlasEntity
{
Attributes =
{
["owner"] = BinaryData.FromObjectAsJson("ExampleOwner"),
["modifiedTime"] = BinaryData.FromObjectAsJson(0),
["createTime"] = BinaryData.FromObjectAsJson(0),
["qualifiedName"] = BinaryData.FromObjectAsJson("exampleaccount2"),
["name"] = BinaryData.FromObjectAsJson("ExampleStorageAccount2"),
["description"] = BinaryData.FromObjectAsJson("Example Description"),
["publicAccessLevel"] = null
},
TypeName = "azure_storage_account",
CreatedBy = "ExampleCreator",
Status = EntityStatus.Active,
UpdatedBy = "ExampleUpdator",
Version = 0L,
Contacts =
{
["Expert"] = new ContactInfo[]
{
new ContactInfo
{
Id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
Info = "Example Expert Info",
}
},
["Owner"] = new ContactInfo[]
{
new ContactInfo
{
Id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
Info = "Example Owner Info",
}
}
},
}},
};
Response<EntityMutationResult> response = client.BatchCreateOrUpdate(body);
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("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
using RequestContent content = RequestContent.Create(new
{
referredEntities = new object(),
entities = new object[]
{
new
{
typeName = "azure_storage_account",
attributes = new
{
owner = "ExampleOwner",
modifiedTime = 0,
createTime = 0,
qualifiedName = "exampleaccount1",
name = "ExampleStorageAccount1",
},
contacts = new
{
Expert = new object[]
{
new
{
id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
info = "Example Expert Info",
}
},
Owner = new object[]
{
new
{
id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
info = "Example Owner Info",
}
},
},
status = "ACTIVE",
createdBy = "ExampleCreator",
updatedBy = "ExampleUpdator",
version = 0L,
},
new
{
typeName = "azure_storage_account",
attributes = new
{
owner = "ExampleOwner",
modifiedTime = 0,
createTime = 0,
qualifiedName = "exampleaccount2",
name = "ExampleStorageAccount2",
description = "Example Description",
},
contacts = new
{
Expert = new object[]
{
new
{
id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
info = "Example Expert Info",
}
},
Owner = new object[]
{
new
{
id = "30435ff9-9b96-44af-a5a9-e05c8b1ae2df",
info = "Example Owner Info",
}
},
},
status = "ACTIVE",
createdBy = "ExampleCreator",
updatedBy = "ExampleUpdator",
version = 0L,
}
},
});
Response response = client.BatchCreateOrUpdate(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());