Skip to main content

Certainly! Below is an enhanced version of your README.md for SnailDB:

# SnailDB

SnailDB is a lightweight, non-SQL database for Python, designed for simplicity and ease of use.

## Table of Contents

- [Installation](#installation)
- [Version](#version)
- [Quick Start](#quick-start)
- [Examples](#examples)
- [Delete](#delete)
- [Query](#query)
- [Features](#features)
- [Contributing](#contributing)
- [License](#license)

## Installation

```bash
pip install snailDB

Version

from snaildb import version

# To check which version of SnailDB is installed
print(version())

Quick Start

from snaildb import SnailDB

# Create a SnailDB instance
db = SnailDB("database.json", "data")

# Get the name of the database
print("Using database:", db.get_db_name())

# Insert data
db.insert({"key": "1", "name": "John", "age": 30})
db.insert({"key": "2", "name": "Alice", "age": 25})

# Get data
print("Key '1' data:", db.get("1"))

Examples

# Setup the database on db
db = SnailDB("my_database.json", "data")

# Example 1: Insert a document using insert() function
db.insert({"key": "1", "name": "Akhil", "age": 20})

# Example 2: Insert multiple documents using insert_all() function
db.insert_all({"key": "3", "name": "Jon", "age": 10}, {"key": "4", "name": "Ali", "age": 21})
# Example 3: Update the database
# For updating the database, use the key value.
db.update("1", {"name": "John", "age": 31})

# Example 4: View the database
# Print data without pretty formatting:
print(db.get("1"))

# Print data with pretty formatting:
print(db.get("1", pretty=True))
# Example 5: View all the database
# Print all data without pretty formatting:
print(db.get_all())

# Print all data with pretty formatting:
print(db.get_all(pretty=True))

Delete

# Example 6: Delete data
# For deleting data, enter the key
db.delete("2")

# Example 7: Delete the entire database
# The db database will be deleted
db.drop()

Query

# Query Function without pretty formatting
test = db.query("age", "<", 30)
print(test)

# Query Function with pretty formatting
test = db.query("age", "<", 30, pretty=True)
print(test)

# We can use all operators

#Greater Operator

test = db.query("age", ">", 30, pretty=True)
print(test)

#Lesser Operator
test = db.query("age", "<", 30, pretty=True)
print(test)

#Equal to operator
test = db.query("name", "=", "Ali", pretty=True)
print(test)

# Lesser and Equal to operator
test = db.query("age", "<=", 29, pretty=True)
print(test)

# Greater and Equal to operator
test = db.query("age", ">=", 29, pretty=True)
print(test)

# Not Equal to operator
test = db.query("age", "!=", 29, pretty=True)
print(test)

# Query Method with Skip Method
test = db.query("age", "<", 30, skip=1, pretty=True)
print(test)

# Query Method with Limt method
test = db.query("age", "<", 30, limt=1, pretty=True)
print(test)

# Query Method with Limt method and skip method
test = db.query("age", "<", 30, skip=1, limt=1, pretty=True)
print(test)

Features

  • Lightweight: SnailDB is designed to be a lightweight database, providing basic functionalities without unnecessary complexities.
  • Simple API: The API is easy to use, making it suitable for small to medium-sized projects.
  • Persistent Storage: Data is stored in a JSON file, ensuring persistence across sessions.
  • Basic CRUD Operations: SnailDB supports basic Create, Read, Update, and Delete operations.
  • Query Functionality: Perform simple queries based on field name, operator, and target value.

Contributing

Contributions are welcome! If you'd like to contribute to SnailDB, please check the Contributing Guide.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for snailDB 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snailDB 0.0.3
File Size Uploaded
snailDB-0.0.3.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snailDB 0.0.3
File Interpreter ABI Platform
snailDB-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / snailDB-0.0.3.tar.gz

Download URL snailDB-0.0.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8bc3d88a132eab8a1ed801df38524c03f9897e7bc20628513b1be1bf319bf1dc
BLAKE2b-256 checksum
How to use checksums
1fb5262b735a919ccb72338ae4003382059e701cd2cf577d253ac58a70c4faff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / snailDB-0.0.3-py3-none-any.whl

Download URL snailDB-0.0.3-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f445389f71936a18cef9ea5517413b77b48384368eb49e8599f2efd8114f014
BLAKE2b-256 checksum
How to use checksums
a3b14af24f270ae2955e28521fee9569d32f5815d0fa78b5bf8844352d1c966f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page