Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pydbjson

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pydbjson

A small database using json

  • 0.0.5
  • PyPI
  • Socket score

Maintainers
1

PyDbJson

pydbjson is a simple Python library for managing JSON-based databases.

Table of Contents

  • Installation

  • Description

  • Usage

Installation

You can install pydbjson using pip:


pip install pydbjson

Description

pydbjson provides a convenient way to interact with JSON-based databases in Python. It allows you to load data from a JSON file, insert, retrieve, delete, and find documents, and save the data back to the file.

Usage

Importing the library


from pydbjson.pydbjson import pydbjson

Creating an instance of pydbjson


db = pydbjson("database.json")

Create an instance of the pydbjson class by providing the filename or path of the JSON database file.

Inserting a document


document = {"name": "John", "age": 30}

key = db.insert_one(document)

Insert a document into the database. The insert_one method returns the key of the inserted document.

Find a document


document = {"name": "John"}

found_document = db.find_one(document)

Find a document from the database based on the provided data.

Deleting a document


db.delete_one(found_document)

Delete a document from the database based on the data.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc