Skip to main content

A simple NoSQL-like interface for SQLite

Project description

Odeta

A simple NoSQL-like interface for SQLite.

Installation

pip install odeta

Usages

Importing the Library

from odeta import database
or
from odeta import localbase

Initializing the Database and create a table in it.

db = database("my_database.db")
# or db = localbase("my_database.db")
users = db("users")

Fetching Data

Fetch all records from the table:

# Fetch records by ID
print(users.get("this_is_the_id")) 

# Fetch all records
print(users.fetch())

Fetch records that match a specific query:

print(users.fetch({"name": "Bob Johnson"}))

print(users.fetch({"name?contains": "Bob"}))

# for all the records with OR condition
print(users.fetchall({"name?contains": "Bob", "age" : 30}))

# for all the records with AND condition
print(users.fetch({"name?contains": "Bob", "age" : 30}))

Inserting Data

Insert a new record into the table:

new_user_id = users.put({"name": "Alice Smith", "age": 30})
print(new_user_id)

Updating Data

Update an existing record in the table:

users.update({"name": "Alice Johnson", "age": 31}, new_user_id)

Deleting Data

Delete a record from the table:

users.delete(new_user_id)

Count, Truncate & Drop

Operations on the table:

users.count()
users.truncate()
users.drop()

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

odeta-0.1.37.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

odeta-0.1.37-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file odeta-0.1.37.tar.gz.

File metadata

  • Download URL: odeta-0.1.37.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.2

File hashes

Hashes for odeta-0.1.37.tar.gz
Algorithm Hash digest
SHA256 b84dc4231a1eebf89e886b167f9af665d01699ac0e8eda206050f37ba9145521
MD5 a506a8d39cd852d80b4a3a15cb5433af
BLAKE2b-256 e79dce6cababaec11891740afd471403843c0e6bd831b7584f4e8d75491e9c0a

See more details on using hashes here.

File details

Details for the file odeta-0.1.37-py3-none-any.whl.

File metadata

  • Download URL: odeta-0.1.37-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.2

File hashes

Hashes for odeta-0.1.37-py3-none-any.whl
Algorithm Hash digest
SHA256 8185a9df9046707faa9376e7f9ccca823e19ae570bde7f73cedf24264e65eac3
MD5 fd39099bc1bdee808c59e795b67c2cb5
BLAKE2b-256 4ddbc89580d3cd30d51dfd87482679e5168e377fb3ed9193d78da1c80c9c816b

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