Skip to main content

No project description provided

Project description

SaracenDB Documentation

Introduction

SaracenDB is a Python-based NoSQL database, offering a simple and flexible data storage solution. It uses BSON for data serialization and allows users to create, read, update, and delete data in an easy-to-use manner.

Class Initialization

db = SaracenDB(filename: str, collection: str='default')
  • filename : Name of the file that will store the database.
  • collection : Name of the collection to use initially. If not provided, the default collection name will be 'default'.

Methods

Add

Add a new entry to the current collection.

db.add(entry: dict) 
  • entry : The data to be added to the collection, in dictionary form.

Find

Finds entries in the current collection that match a given key-value pair.

db.find(key: str, value: str)
  • key : The key to look for in the entries.
  • value : The value to look for in the entries.

Get

Get an entry by its ID in the current collection.

db.get(id: int)
  • id : The ID of the entry.

Edit

Edit a key-value pair in an entry in the current collection.

db.edit(id: int, key: str, value)
  • id : The ID of the entry.
  • key : The key to edit.
  • value : The new value.

rm_item

Delete an entry from the current collection using its ID.

db.rm_item(id: int)
  • id : The ID of the entry.

rm_key

Delete a key from an entry in the current collection.

db.rm_key(key: str, id)
  • key : The key to delete.
  • id : The ID of the entry.

rm_coll

Delete a collection.

db.rm_coll(collection: str)
  • collection : The name of the collection to delete.

rm_key_for_all

Delete a key from all entries in the current collection.

db.rm_key_for_all(key: str)
  • key : The key to delete.

add_key_for_all

Add a key to all entries in the current collection.

db.add_key_for_all(key: str, value='')
  • key : The key to add.
  • value : The initial value of the new key.

add_coll

Create a new collection.

db.add_coll(collection: str)
  • collection : The name of the new collection.

use_coll

Switch to another collection.

db.use_coll(collection: str)
  • collection : The name of the collection to switch to.

push

Save changes to the database.

db.push()

compact

Remove deleted entries from the database file to reduce file size.

db.compact()

to_json

Write the current collection to a JSON file.

db.to_json(path: str)
  • path : The path of the JSON file.

to_yaml

Write the current collection to a YAML file.

db.to_yaml(path: str)
  • path : The path of the YAML file.

db_to_json

Write the entire database to a JSON file.

db.db_to_json(path: str)
  • path : The path of the JSON file.

db_to_yaml

Write the entire database to a YAML file.

db.db_to_yaml(path: str)
  • path : The path of the YAML file.

json_to_db

Create a new database from a JSON file.

db.json_to_db(path: str)
  • path : The path of the JSON file.

yaml_to_db

Create a new database from a YAML file.

db.yaml_to_db(path: str)
  • path : The path of the YAML file.

import_json_to_coll

Import a JSON file to the current collection.

db.import_json_to_coll(path: str)
  • path : The path of the JSON file.

import_yaml_to_coll

Import a YAML file to the current collection.

db.import_yaml_to_coll(path: str)
  • path : The path of the YAML file.

reindex

Reindex the current collection.

db.reindex()

coll_list

List all collections in the database.

db.coll_list()

get_coll

Return the current collection.

db.get_coll()

set_coll

Overwrite the current collection.

db.set_coll(coll: list)
  • coll : The new collection data, in list form.

get_full_db

Return the full database.

db.get_full_db()

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

saracendb-0.8.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saracendb-0.8-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file saracendb-0.8.tar.gz.

File metadata

  • Download URL: saracendb-0.8.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for saracendb-0.8.tar.gz
Algorithm Hash digest
SHA256 fe2fa07163d1b4156b0d47e3dda0143ba45ae6785e0cbf77c61e9ac685dac658
MD5 84da7acde9c33a75f99d9eab7879490b
BLAKE2b-256 c65692d06e81abbfa231c54ea6b3b1013ce277df3886008421e5cce48e7a3f26

See more details on using hashes here.

File details

Details for the file saracendb-0.8-py3-none-any.whl.

File metadata

  • Download URL: saracendb-0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for saracendb-0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f63185d1dbf5040c4f3ae13a16a800f47163d9983e4b01036c56f026d61b2852
MD5 dabfde94d2b1685e53613ea5a41a0b50
BLAKE2b-256 9c03293414329ca1a90b9e857a666f1bb385b38c3382a97b32ae56e51591b74b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page