咨询Azure Cosmos Graph DB批量导入工具的JSON输入格式
Azure Cosmos Graph DB Bulk Import JSON Format
When using the bulk executor tool for Azure Cosmos Graph DB, your JSON input needs to represent graph nodes (vertices) and edges following the Gremlin-compatible structure required by Cosmos DB. Below are the detailed formats and examples to guide you:
Nodes (Vertices)
Each node entry must include these required fields:
id: Unique string identifier for the nodelabel: The graph label/class for the node (e.g., "User", "Product")- You can add custom key-value properties as needed to store additional data.
Example Node JSON Array
[ { "id": "user123", "label": "User", "name": "Satish", "email": "satish@example.com", "age": 30 }, { "id": "product456", "label": "Product", "name": "Wireless Headphones", "price": 99.99, "inStock": true } ]
Edges
Each edge entry must include these required fields to define relationships between nodes:
id: Unique string identifier for the edgelabel: The relationship type (e.g., "Purchased", "Follows")source: Theidof the source node (the start of the relationship)target: Theidof the target node (the end of the relationship)- Optional custom properties can be added to capture details about the relationship.
Example Edge JSON Array
[ { "id": "purchase_1", "label": "Purchased", "source": "user123", "target": "product456", "purchaseDate": "2024-05-20", "quantity": 1 } ]
Key Implementation Notes
- You can combine nodes and edges in a single JSON input, but it’s best practice to import nodes first to avoid missing reference errors in edges.
- Ensure all
sourceandtargetvalues in edges match existing nodeids to prevent import failures. - JSON data types (strings, numbers, booleans, date strings) are preserved directly in Cosmos DB.
The bulk executor tool processes these structured JSON entries to efficiently load graph data into your Cosmos DB account while adhering to Gremlin graph model constraints.
内容的提问来源于stack exchange,提问作者satish a




