pysdb
pysdb is a lightweight , portable, embeddable database management library
Import first:
import pysdb
concepts
SDB_STORE
SDB_STORE is a group of Databases
it's the directory where all the Databases exists.
SDB_STORE can be created by the following command:
$ mkdir /path/to/SDB_STORE/ && touch /path/to/SDB_STORE/sdbstore
if you prefer a different directory name change DB_STORE to whatever name you like , for example:
$ mkdir /path/to/MY_STORE/ && touch /path/to/MY_STORE/sdbstore
DATABASE
group of Collections is a Database
COLLECTIONS
a bundle of Records is a collection (it's kinda like a Table)
Records
Records are like a row in a table
Record is pure python Dictionary
example:
student_record1 = {
"name": "student1_name1",
"age":19
}
example
import pysdb
store = pysdb.UseStore('/path/to/DB_STORE/') # use the created store (returns a pointer to store)
store.CreateDB('db') # creates a db in store (returns true or false)
db = store.OpenDB('db') # opens a db in store (return a pointer to db)
store.CloseDB('db') # closes an opened db
store.DropDB('db') # deletes the entire database (return true or false)
store.LookForDB('db') # checks if a Database exists (returns true or false)
db.CreateCl('cl') # creates a collection in db (returns true or false)
cl = db.OpenCl('cl') # opens a collection in db (returns a pointer to the collection)
db.CloseCl('cl') # closes the collection
db.DropCl('cl') # deletes a collection in db (returns true or false)
db.LookForCl('cl') # checks if a collection exists (returns true or false)
# create a record (pure python dictionary)
student_record1 = {
"name": "student_name1",
"age":19
}
student_record2 = {
"name": "student_name2",
"age":20
}
cl.AddRec('student_record_1', student_record1) # adds a record to cl
cl.UpdateRect('student_record_1', student_record2) # updates the record in cl
cl.ReadRec('student_record_1') # returns a Record ( python dictionary - same as above student_record1 )
cl.RemoveRect('student_record_1') # removes a Record in cl
Release files for pysdb 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysdb-0.0.3.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysdb-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / pysdb-0.0.3.tar.gz
| Download URL | pysdb-0.0.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c842d07ac3e9891dc4f8b2e4de4b0a8cdb7f5f73b1a93fa1282c34a84d4908d1
|
|
BLAKE2b-256 checksum How to use checksums |
22a23193a6ef77526deb74c4d4223c30a72abaf2328d75409916ac9b3b6451ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2
|
Release files / pysdb-0.0.3-py3-none-any.whl
| Download URL | pysdb-0.0.3-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e6e5ebcfa6666994717466860f81cbbea6aa3a37378ba0f32e35f882f495f83
|
|
BLAKE2b-256 checksum How to use checksums |
01fc7d45981a569de1e718c4214580ba603d3e553c768cfc69166250b2bf5d35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2
|