【14】python和orientab连接,导入entity的实例
2016-10-21 11:59
344 查看
1,python和orientab连接,在插入了新的实例之后,可以直接再次插入不同属性的数据
#!user/bin/env/python
# coding: utf-8
import 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)
#!user/bin/env/python
# coding: utf-8
import 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)
相关文章推荐
- python 26 连接 mysql 实例
- oracle数据库、客户端安装以及ps/sql连接和导入表实例
- python连接MySQL数据库实例分析
- python(14)类,方法,对象,实例
- 【python学习】python连接数据库实例
- Python连接MySQL的实例代码
- python连接mysql实例分享
- 【python】实例-把两个无规则的序列连接成一个序列,并删除重复的元素,新序列按照升序排序
- Python MySQLdb模块连接操作mysql数据库实例
- EntityFramework.SqlServer.dll 中发生 其他信息: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
- oracle数据库、客户端安装以及ps/sql连接和导入表实例
- python自动化测试之连接几组测试包实例
- python自动化测试之连接几组测试包实例
- python连接MySQL数据库实例分析
- Python菜鸟学习手册14----标准库+代码实例
- Dive Into Python 学习记录1-函数/模块导入/字典/列表/元组/字符串分割、连接、格式化/映射list/
- Python连接MySQL数据库通信实例以及中文乱码的解决办法
- python连接oracle数据库实例
- mysql导入csv文件,与python连接
- python连接mysql实例分享