1,python和orientab连接,在插入了新的实例之后,可以直接再次插入不同属性的数据
#!user/bin/env/python
# coding: utf-8import pyorient
client = pyorient.OrientDB("localhost", 2424)
session_id = client.connect( "root", "123456" )
# client.db_drop('TEMP')
# client.db_create('TEMP', pyorient.DB_TYPE_GRAPH, pyorient.STORAGE_TYPE_MEMORY)
client.db_open("TEMP", "root", "123456" )
if __name__ == "__main__":
cluster_id = client.command("create class v_doctor extends V")
cluster_id = client.command("create class v_patient extends V")
cluster_id = client.command("create class E_has_check_hospitality extends E")
doctor = {'@v_doctor':
{
'name': '{n}'.format(n='Danay'),
'age':'{n}'.format(n=22)
}}
vDoctor = client.record_create(-1, doctor)
doctor = {'@v_doctor':
{
'name': '{n}'.format(n='Anna'),
'gender': '{n}'.format(n='女')
}}
vDoctor = client.record_create(-1, doctor)