Skip to main content

Database client for Mysql, MongoDB and Sqlite

Project description

odbms

odbms is a Python package for managing MySQL, MongoDB, SQLite, and PostgreSQL database instances.

Features

  • Supports multiple database management systems (MySQL, MongoDB, SQLite, PostgreSQL)
  • Provides a unified interface for database operations across different DBMSs
  • Includes an ORM-like model system for easy data manipulation
  • Supports table creation, alteration, and basic CRUD operations

Installation

Install odbms using pip:

pip install odbms

Usage

from odbms import DBMS

# Initialize with default settings
DBMS.initialize_with_defaults('sqlite', 'database_name')

# Or initialize with custom settings
DBMS.initialize('postgresql', port=5432, username='postgres', password='', database='database_name')
from odbms import Model

class User(Model):
    TABLE_NAME = 'users'

    def init(self, email: str, name: str, password: str, image: str = '', gat: str ='', grt: str ='', created_at=None, updated_at=None, id=None):
        super().init(created_at, updated_at, id)

        self.email = email
        self.name = name
        self.password = password
        self.image = image
        self.gat = gat
        self.grt = grt

#Create the table if not mongodb (sqlite, mysql, postgresql)
User.create_table()
# Insert a new user
new_user = User('test@user.com', 'Test User', 'MyPassword')
new_user.save()

# Retrieve all users
users = User.all()

# Find a specific user
user = User.find_one({'email': 'test@user.com'})

# Update a user
user.name = 'Updated Name'
user.save()

# Get the json representation of the user
user.json()

# Delete a user
Delete a user
User.remove({'email': 'test@user.com'})

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

odbms-0.3.7.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

odbms-0.3.7-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file odbms-0.3.7.tar.gz.

File metadata

  • Download URL: odbms-0.3.7.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for odbms-0.3.7.tar.gz
Algorithm Hash digest
SHA256 704d944cb9dbd13477e5cea0ed885db24efb1df8aefb22f76239ea771f4bf14c
MD5 25738327c1f38d30a3b093e90bb14b4a
BLAKE2b-256 97c8b441dc046a5b56eae712a41f236bc73627be804d7f5aedfb4e22307c3da6

See more details on using hashes here.

File details

Details for the file odbms-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: odbms-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for odbms-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9ee478d929d40a253dc0efe4503756a9ff1fa393d5820dc772d89f6c118649
MD5 befb4e3909bf677e3184624246959f69
BLAKE2b-256 2c7c0deaef89e0aa003054d5a73bbaa54067379d8de186d13e5d66e2adf8824a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page