A simple declarative ORM for SQLite
Project description
Table of Contents
➤ Description
A declarative ORM from scratch, compatible with SQLite
➤ Installation
Use the package manager pip to install [your project name].
pip install ...
📚 Usage
from flamel.base import Base
from flamel.column import Column, Integer, String
class Worker(Base):
id = Column("id", Integer, primary_key=True, autoincrement=True)
name = Column("name", String, nullable=False, unique=True)
email = Column("mail", String, nullable=False, unique=True)
Base.set_engine("company.db")
Base.create_tables()
import sqlite3
conn = sqlite3.connect("company.db")
cursor = conn.cursor()
cursor.execute("INSERT INTO Worker(name, mail) values ('John Doe', 'john.doe@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Jane Smith', 'jane.smith@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Mike Johnson', 'mike.johnson@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Alice Williams', 'alice.williams@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Bob Brown', 'bob.brown@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Charlie Davis', 'charlie.davis@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Eve Miller', 'eve.miller@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Frank Clark', 'frank.clark@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Grace White', 'grace.white@example.com')")
cursor.execute("INSERT INTO Worker(name, mail) values ('Henry Harris', 'henry.harris@example.com')")
conn.commit()
conn.close()
query = Worker.query().select().filter(name="John Doe")
print(query)
result = query.execute()
print(result)
Base.engine_close()
➤ Roadmap
- MVP of the ORM
- Implement a way to insert data
- Implement group_by
- Implement having
➤ Credits
This project is thanks to other projects and people:
➤ License
Licensed under MIT.
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
flamel_orm-0.0.1.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for flamel_orm-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae9b0b7bdf28fc60c5335031e2095d7fd13d46ec6ca6631909013e746fc65423 |
|
MD5 | 48930d855fd25a019ee790adda6b986f |
|
BLAKE2b-256 | 415bf0d91484a2b299c45b5891c3427a1cedd95a9a47d6100b3a990b0fce48b5 |