The Python interface to TrisDb
Project description
trisdb-py
=========
The Python interface to TrisDb
### Installation
```
sudo pip install trisdb-py
```
### Usage
```python
>>> from trisdb import *
>>> # Connect and insert some data
>>> db = TrisDbConnection('localhost', 1205)
>>> db.create('Alice', 'loves', 'pizza')
>>> db.create('Kate', 'likes', 'football')
>>> # Print all records
>>> result = db.get('*')
>>> for i in result:
>>> print i['subject'] + '-' + i['predicate'] + '-' + i['object']
>>> # Who likes football?
>>> result = db.gets('*', 'likes', 'football')
>>> for i in result:
>>> print i
>>> # Batch insert using MULTI
>>> m = db.multi()
>>> for i in range(0,10):
>>> m.create('key'+str(i), 'value', 'value'+str(i))
>>> db.execute(m)
>>> # Clear all data from DB and close connection
>>> db.clear()
>>> db.close()
```
=========
The Python interface to TrisDb
### Installation
```
sudo pip install trisdb-py
```
### Usage
```python
>>> from trisdb import *
>>> # Connect and insert some data
>>> db = TrisDbConnection('localhost', 1205)
>>> db.create('Alice', 'loves', 'pizza')
>>> db.create('Kate', 'likes', 'football')
>>> # Print all records
>>> result = db.get('*')
>>> for i in result:
>>> print i['subject'] + '-' + i['predicate'] + '-' + i['object']
>>> # Who likes football?
>>> result = db.gets('*', 'likes', 'football')
>>> for i in result:
>>> print i
>>> # Batch insert using MULTI
>>> m = db.multi()
>>> for i in range(0,10):
>>> m.create('key'+str(i), 'value', 'value'+str(i))
>>> db.execute(m)
>>> # Clear all data from DB and close connection
>>> db.clear()
>>> db.close()
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
trisdb-py-1.0.0.tar.gz
(3.0 kB
view details)
File details
Details for the file trisdb-py-1.0.0.tar.gz
.
File metadata
- Download URL: trisdb-py-1.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fe66db35581c52178484062a7d297d558bc95bbb8dc07aaf4c497ca6e8090c |
|
MD5 | a8febded6be8f702fdd4f8ceb12c4243 |
|
BLAKE2b-256 | a7918c7f8141a0b5f3afac79504bc12b80add8c6c5a624400684fc421d58cc9e |