python里orient_OrientDB Python连接操作
OrientDB Python連接操作
Python的OrientDB驅動程序使用二進制協議。 PyOrient是git hub項目名稱,它用于將OrientDB與Python連接起來并操作數據。 它適用于OrientDB 1.7及更高版本。
以下命令用于安裝PyOrient。
pip install pyorient
可以使用名為demo.py的腳本文件執行以下任務 -
創建客戶端實例,也就是創建一個連接。
創建名為DB_Demo的數據庫。
打開名為DB_Demo的數據庫。
創建類my_class。
創建屬性ID和名稱。
將記錄插入類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
總結
以上是生活随笔為你收集整理的python里orient_OrientDB Python连接操作的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 维生素一瓶多少钱啊?
 - 下一篇: “辞宗盛荆梦”下一句是什么