Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fernando24164/flamel
A simple ORM for SQLite
https://github.com/fernando24164/flamel
orm simple sqlite
Last synced: 3 days ago
JSON representation
A simple ORM for SQLite
- Host: GitHub
- URL: https://github.com/fernando24164/flamel
- Owner: fernando24164
- License: mit
- Created: 2024-05-11T20:36:44.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-05-19T19:51:16.000Z (6 months ago)
- Last Synced: 2024-05-19T20:44:50.864Z (6 months ago)
- Topics: orm, simple, sqlite
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Table of Contents
* [Description](#description)
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)## ➤ Description
A declarative ORM from scratch, compatible with SQLite
## ➤ Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install flamel.
```bash
pip install flamel-orm
```## 📚 Usage
```python
from flamel.base import Base
from flamel.column import Column, Integer, Stringclass 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()
worker = Worker(name='John Doe', email='[email protected]')
worker2 = Worker(name='Jane Smith', email='[email protected]')
worker3 = Worker(name='Mike Johnson', email='[email protected]')Base.insert(worker)
Base.insert(worker2)
Base.insert(worker3)query = Worker.query().select().filter(name="John Doe")
print(query)
result = query.execute()
print(result)Base.engine_close()
```## ➤ Roadmap
- [x] MVP of the ORM
- [x] Implement a way to insert data
- [x] Implement group_by
- [x] Implement having## ➤ Credits
This project is thanks to other projects and people:
- [SQLAlchemy architecture](https://aosabook.org/en/v2/sqlalchemy.html) -
- [SQLAlchemy github](https://github.com/sqlalchemy/sqlalchemy) -
## ➤ License
Licensed under [MIT](https://opensource.org/licenses/MIT).