from ultipa import Connection
from ultipa import UltipaConfig,ULTIPA_REQUEST,ULTIPA
defaultConfig = UltipaConfig()
conn = Connection.GetConnection(hosts=["host:port"],username="root",
password="root",defaultConfig=defaultConfig)
schema = ULTIPA_REQUEST.Schema("default",
[
ULTIPA_REQUEST.Property("name", ULTIPA.PropertyType.PROPERTY_STRING),
ULTIPA_REQUEST.Property("age", ULTIPA.PropertyType.PROPERTY_INT32)]
)
rows = []
for i in range(1000):
rows.append(ULTIPA.Node({"name":f"name{i}","age":i}))
ret = conn.InsertNodesBatchBySchema(schema, rows,InsertConfig(ULTIPA.InsertType.UPSERT))
print(ret.toJSON())