Skip to content

jaliliB21/sqlorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLiteORM

A lightweight, easy-to-use Object Relational Mapping (ORM) framework for SQLite databases in Python.

Overview

SQLiteORM simplifies database interactions by allowing developers to define models using Python classes.
It abstracts complex SQL queries into simple Python methods, making database management more intuitive and less error-prone.

Features

  • Simple and intuitive model definition
  • Automatic table creation and synchronization
  • Basic CRUD operations (Create, Read, Update, Delete)
  • Bulk insert support for performance optimization
  • Customizable fields (e.g., unique, nullable, default)
  • Foreign key support

Installation

pip install sqliteorm_py

Getting Started

1. Create a New Project

sqliteorm-admin createproject myproject
cd myproject

2. Define Models

from sqliteorm_py.basemodel import BaseModel
from sqliteorm_py.fields import CharField, IntegerField

class User(BaseModel):  
    table_name = "users"  
    id = IntegerField(primary_key=True, autoincrement=True)  
    name = CharField(max_length=100, unique=True)  
    age = IntegerField()  

3. Apply Migrations

py manage.py migrations

4. Insert Data

from models import User  

User.insert(name="Alice", age=30)  
User.insert(name="Bob", age=25)  

5. Query Data

users = User.all()  
for user in users:  
    print(user.name, user.age)    

6. Update Records

User.update({"name": "Alice"}, age=35)   

7. Delete Records

User.delete(name="Bob")  

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss the proposed changes

About

This ORM framework is designed to simplify database operations by allowing developers to work with relational data using object-oriented programming principles. With a clean and developer-friendly API, you can map database tables to Python classes and seamlessly perform queries, updates, and migrations without writing complex SQL code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages