OrientDB driver for Python utilizes the parallel convention. PyOrient is the git center point project name which assists with interfacing OrientDB with Python. It works with OrientDB variant 1.7 and later.
The accompanying order is utilized to introduce PyOrient.
pip install pyorient
You can utilize the content document named demo.py to do the accompanying undertakings −
- Make a customer case implies make an association.
- Make DB named DB_Demo.
- Open DB named DB_Demo.
- Make class my_class.
- Make properties id, and name.
- Supplement record into my group.
//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')")
Execute the above content utilizing the accompanying order.
$ python demo.py