Skip to main content

RiceDB™

A simple and secure Python database package built on SQLite.

RiceDB is a lightweight Python package that simplifies SQLite database operations. Instead of writing SQL for common tasks, you can use a clean and easy-to-read Python API.

RiceDB is designed for beginners, students, hobbyists, and developers who want a simple database solution without setting up a database server.


Features

  • Simple and readable Python API
  • Built on SQLite
  • No external database server required
  • Lightweight and easy to use
  • Safe parameterized queries
  • Automatic table management
  • Cross-platform
  • Open source

Installation

bash pip install ricedb


Quick Start

python from ricedb import Database

db = Database("school.db")

db.create_table( "students", { "id": "id", "name": "str", "age": "int", "active": "bool", "created_at": "timenow", } )

db.insert( "students", { "name": "Amy", "age": 16, "active": True, } )

rows = db.read("students")

print(rows)

db.close()


Supported Data Types

RiceDB Type SQLite Type
id INTEGER PRIMARY KEY AUTOINCREMENT
int INTEGER
float REAL
str TEXT
bool INTEGER
bytes BLOB
datetime TEXT
timenow CURRENT_TIMESTAMP

Main API

Database

python db = Database("example.db")


Create Table

python db.create_table( "users", { "id": "id", "name": "str", "age": "int" } )


Insert Data

python db.insert( "users", { "name": "Alice", "age": 20 } )


Read Data

python db.read("users")

Read with conditions

python db.read( "users", where={ "age":20 } )


Get One Record

python db.get( "users", where={ "id":1 } )

Returns one dictionary or None.


Update Data

python db.update( "users", { "age":21 }, where={ "id":1 } )


Delete Data

python db.delete( "users", where={ "id":1 } )


Count Records

python db.count("users")


Check Record Exists

python db.exists( "users", where={ "name":"Alice" } )

Returns

python True

or

python False


Create Column

python db.create_column( "users", "email", "str" )


Delete Column

python db.delete_column( "users", "email" )


Rename Column

python db.rename_column( "users", "name", "full_name" )


Rename Table

python db.rename_table( "users", "members" )


Clear Table

python db.clear_table("members")


List Tables

python db.list_tables()


List Columns

python db.list_columns("members")


Table Information

python db.table_info("members")


Execute SQL

python db.execute( "SELECT * FROM members" )


Close Database

python db.close()


Example

python from ricedb import Database

db = Database("example.db")

db.create_table( "students", { "id":"id", "name":"str", "score":"float" } )

db.insert( "students", { "name":"Amy", "score":95.5 } )

print(db.read("students"))

db.close()


Requirements

  • Python 3.9+
  • SQLite (built into Python)

Project Website

https://riceplatform.org/db


Source Code

https://github.com/RicePlatform/RiceDB


License

RiceDB is licensed under the GNU General Public License v3.0 (GPL-3.0).

See the LICENSE file for details.


Author

HONG-CHI WU


© Rice Platform

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ricedb-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

ricedb-0.2.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file ricedb-0.2.0.tar.gz.

File metadata

  • Download URL: ricedb-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for ricedb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 691dc2890171185e367d57e65a7b0d0a056fc90a67a0795a122083c1cbe54362
MD5 4f7134bf10e245add9a9784c534803aa
BLAKE2b-256 4b657711edb9181dad75584ff650833ee0788577d7083b2abf272352d14d5023

See more details on using hashes here.

File details

Details for the file ricedb-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ricedb-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for ricedb-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edd859bd1941ef8f547d6121e74d5082e3aa66c7f209f386bc03b88a57882b6a
MD5 6e24e4927e5d940f14beafdfa6e6f551
BLAKE2b-256 bb4255fcaef74bb0ee3c821a260287b1dcfb732c4e6f83125219f76ab34dd5bd

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