Skip to main content

A simple declarative ORM for SQLite

Project description

Flamel Logo

Python version License

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 flamel-orm

📚 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.2.tar.gz (9.0 kB view hashes)

Uploaded Source

Built Distribution

flamel_orm-0.0.2-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

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