Skip to content
@libdb

libdb

libdb

A simple JSON database manager for Python.

Installation

pip install libdb
# or
pip3 install libdb

Usage

from libdb import JSONDatabase

# Initialize the database
db = JSONDatabase('mydb.json')

# Create a new entry
db.create('name', 'Alice')

# Read an entry
print(db.read('name'))  # Output: Alice

# Update an entry
db.update('name', 'Bob')

# Delete an entry
db.delete('name')

# List all keys
print(db.list_keys())  # Output: []

# Clear the database
db.clear()

# Bulk create entries
items = {
    'name': 'Alice',
    'age': 30,
    'city': 'Wonderland'
}
db.bulk_create(items)

# Search for entries
users = {
    'user1': {'name': 'Alice', 'age': 30},
    'user2': {'name': 'Bob', 'age': 25},
    'user3': {'name': 'Charlie', 'age': 30}
}
db.bulk_create(users)
result = db.search('age', 30)
print(result)  # Output: {'user1': {'name': 'Alice', 'age': 30}, 'user3': {'name': 'Charlie', 'age': 30}}

Popular repositories Loading

  1. libdb libdb Public

    Python Database Management Json File Very Fast and Easy

    JavaScript 3

  2. .github .github Public

Repositories

Showing 2 of 2 repositories
  • libdb Public

    Python Database Management Json File Very Fast and Easy

    libdb/libdb’s past year of commit activity
    JavaScript 3 MIT 0 0 0 Updated Jul 31, 2024
  • .github Public
    libdb/.github’s past year of commit activity
    0 MIT 0 0 0 Updated Jul 26, 2024

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…