trisdb的python接口
trisdb-p的Python项目详细描述
trisdb-trisdb-pytrisdb-pytrisdb-trisdb的python接口
`` ` ` ` ` `
` ` ` ` `
` ` ` ` ` ` ` `
` ` ` ` ` ` `
` ` ` ` ` ` `
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
`插入一些数据
>;>db=trisdconnection('localhost',1205)
>;>gt;db.create('alice,'alice,'loves,'pizza')
>;gt;gt;gt;gt;gt;gt;'create('凯特,'喜欢,'足球''凯特,'like,'football')
>>>;gt;result=db.get('*')
>;>;对于i in-in-result:
>;
>;gt;gt;打印i['subject']+'+i['predic']+'-'+i['object']>
>
>;gt;gt;gt;
;gt;gt;打印所有记录;result=db.db.get('*'*'*>>>;谁喜欢足球?gt;result=db.get('*','喜欢''足球','喜欢','足球')
>>>>;gt;
>>;gt;打印i
>
>>>>;gt;gt;gt;
>>>
>>>>;使用multi
>> gt;批量插入;使用multi
>;m=db.multi()
>>>>;gt>gt;对于i在范围(0,10)内的i i,m.create('key'+str('key'+str(i),'value','value','value','value'+str(i))
>>>;gt;gt;gt;gt;gt;gt/>>;>;db.execute(m)
>gt;清除数据库中的所有数据并关闭连接
>;>;db.clear()
>;>;db.close()
```
`` ` ` ` ` `
` ` ` ` `
` ` ` ` ` ` ` `
` ` ` ` ` ` `
` ` ` ` ` ` `
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
`插入一些数据
>;>db=trisdconnection('localhost',1205)
>;>gt;db.create('alice,'alice,'loves,'pizza')
>;gt;gt;gt;gt;gt;gt;'create('凯特,'喜欢,'足球''凯特,'like,'football')
>>>;gt;result=db.get('*')
>;>;对于i in-in-result:
>;
>;gt;gt;打印i['subject']+'+i['predic']+'-'+i['object']>
>
>;gt;gt;gt;
;gt;gt;打印所有记录;result=db.db.get('*'*'*>>>;谁喜欢足球?gt;result=db.get('*','喜欢''足球','喜欢','足球')
>>>>;gt;
>>;gt;打印i
>
>>>>;gt;gt;gt;
>>>
>>>>;使用multi
>> gt;批量插入;使用multi
>;m=db.multi()
>>>>;gt>gt;对于i在范围(0,10)内的i i,m.create('key'+str('key'+str(i),'value','value','value','value'+str(i))
>>>;gt;gt;gt;gt;gt;gt/>>;>;db.execute(m)
>gt;清除数据库中的所有数据并关闭连接
>;>;db.clear()
>;>;db.close()
```