- OrientDB 教程
- OrientDB - 首页
- OrientDB - 概览
- OrientDB - 安装
- OrientDB - 基本概念
- OrientDB - 数据类型
- OrientDB - 控制台模式
- OrientDB 数据库命令
- OrientDB - 创建数据库
- OrientDB - 修改数据库
- OrientDB - 备份数据库
- OrientDB - 恢复数据库
- OrientDB - 连接数据库
- OrientDB - 断开数据库连接
- OrientDB - 数据库信息
- OrientDB - 列出数据库
- OrientDB - 冻结数据库
- OrientDB - 释放数据库
- OrientDB - 配置数据库
- OrientDB - 导出数据库
- OrientDB - 导入数据库
- OrientDB - 提交数据库
- OrientDB - 回滚数据库
- OrientDB - 优化数据库
- OrientDB - 删除数据库
- OrientDB 记录命令
- OrientDB - 插入记录
- OrientDB - 显示记录
- OrientDB - 加载记录
- OrientDB - 重新加载记录
- OrientDB - 导出记录
- OrientDB - 更新记录
- OrientDB - 清空记录
- OrientDB - 删除记录
- OrientDB 类命令
- OrientDB - 创建类
- OrientDB - 修改类
- OrientDB - 清空类
- OrientDB - 删除类
- OrientDB 集群命令
- OrientDB - 创建集群
- OrientDB - 修改集群
- OrientDB - 清空集群
- OrientDB - 删除集群
- OrientDB 属性命令
- OrientDB - 创建属性
- OrientDB - 修改属性
- OrientDB - 删除属性
- OrientDB 顶点命令
- OrientDB - 创建顶点
- OrientDB - 移动顶点
- OrientDB - 删除顶点
- OrientDB 边命令
- OrientDB - 创建边
- OrientDB - 更新边
- OrientDB - 删除边
- OrientDB 高级概念
- OrientDB - 函数
- OrientDB - 序列
- OrientDB - 索引
- OrientDB - 事务
- OrientDB - 钩子
- OrientDB - 缓存
- OrientDB - 日志
- OrientDB - 性能调优
- OrientDB - 升级
- OrientDB - 安全性
- OrientDB - Studio
- OrientDB 接口
- OrientDB - Java 接口
- OrientDB - Python 接口
- OrientDB 有用资源
- OrientDB - 快速指南
- OrientDB - 有用资源
- OrientDB - 讨论
OrientDB - Python 接口
OrientDB 的 Python 驱动程序使用二进制协议。PyOrient 是该 Git Hub 项目的名称,它有助于将 OrientDB 与 Python 连接起来。它适用于 OrientDB 1.7 及更高版本。
以下命令用于安装 PyOrient。
pip install pyorient
您可以使用名为 demo.py 的脚本文件执行以下任务:
创建客户端实例意味着创建连接。
创建名为 DB_Demo 的数据库。
打开名为 DB_Demo 的数据库。
创建名为 my_class 的类。
创建 id 和 name 属性。
将记录插入 my_class 类中。
//create connection
client = pyorient.OrientDB("localhost", 2424)
session_id = client.connect( "admin", "admin" )
//create a databse
client.db_create( db_name, pyorient.DB_TYPE_GRAPH, pyorient.STORAGE_TYPE_MEMORY )
//open databse
client.db_open( DB_Demo, "admin", "admin" )
//create class
cluster_id = client.command( "create class my_class extends V" )
//create property
cluster_id = client.command( "create property my_class.id Integer" )
cluster_id = client.command( "create property my_class.name String" )
//insert record
client.command("insert into my_class ( 'id','’name' ) values( 1201, 'satish')")
使用以下命令执行上述脚本。
$ python demo.py
广告