{"id":22285362,"url":"https://github.com/benhmoore/pylite","last_synced_at":"2026-05-04T02:37:38.229Z","repository":{"id":73461833,"uuid":"510578289","full_name":"benhmoore/PyLite","owner":"benhmoore","description":"A Python library for working with SQLite databases with model-based syntax similar to Laravel.","archived":false,"fork":false,"pushed_at":"2023-06-08T18:02:44.000Z","size":180,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T15:53:41.893Z","etag":null,"topics":["database","orm","python","sql","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benhmoore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-07-05T03:48:09.000Z","updated_at":"2023-05-23T15:02:44.000Z","dependencies_parsed_at":"2024-01-08T21:43:48.139Z","dependency_job_id":null,"html_url":"https://github.com/benhmoore/PyLite","commit_stats":null,"previous_names":["benhmoore/pylite","benhmoore/litepy"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/benhmoore/PyLite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhmoore%2FPyLite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhmoore%2FPyLite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhmoore%2FPyLite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhmoore%2FPyLite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benhmoore","download_url":"https://codeload.github.com/benhmoore/PyLite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhmoore%2FPyLite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32592716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","orm","python","sql","sqlite3"],"created_at":"2024-12-03T16:52:00.281Z","updated_at":"2026-05-04T02:37:38.211Z","avatar_url":"https://github.com/benhmoore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyLite\n\n**An object relational mapper (ORM) project inspired by Laravel's Eloquent, built for Python.**\n\n## Tests: [![Coverage Status](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/benhmoore/PyLite)\n\nThis is an ongoing project to develop a better, pythonic, model-based system for database manipulation, _heavily_ inspired by Laravel's ORM, Eloquent.\n\nThe goal is to abstract away the necessity of writing SQL queries and maintaining complex relationships between tables. You can instead define readable model classes that represent tables, declare relationships between these models, and manipulate data in way that complements Python syntax.\n\n## Why use PyLite? A quick example.\n\nConsider a rudimentary system that maintains a database of authors and books for a library. An author may have written one book, multiple books, or none at all. We would like to be able to relate each book with an author. That way, we can ask the system for all books written by an author or for the author of a given book. Nice and simple, right?\n\nThe database for this system consists of the following two tables:\n\n```\nauthors\n   - id\n   - name\n\nbooks\n   - id\n   - name\n   - author_id\n```\n\nPython offers excellent support of SQLite out of the box, but you'll still need to get your hands dirty with some SQL queries.\n\nPyLite abstracts all that away.\n\nFirst, we'll define two models to represent the two tables above. These classes inherit from `LiteModel`, which will later be explored in detail. They each represent a single object, or row, in their respective tables:\n\n```python\n\nclass Author(LiteModel):\n\n    def books(self) -\u003e LiteCollection:\n        return this.has_many(Book)\n\nclass Book(LiteModel):\n\n    def author(self) -\u003e LiteModel:\n        return this.belongs_to(Author)\n\n```\n\n...And that's it.\n\nNow, we can operate on our data in a beautifully abstract way:\n\n```python\n\n# Create a new author in the database\njane = Author.create({\n    'name': 'Jane Doe'\n})\n\n# Create a new book in the database\nmoneyBook = Book.create({\n    'name': 'Make Money Fast!'\n})\n\n# \"Attach\" this book to the author\njane.attach(moneyBook)\n\nmoneyBook.author() # Returns the author!\njane.books() # Returns a list of her books!\n```\n\nThere are a host of methods provided by PyLite for manipulating the models we've created. Methods for updating, creating, deleting, relating, and even path finding!\n\nOf course, most use cases are orders of magnitude more complex than this example. PyLite supports all common database relationship types (has_one, has_many, belongs_to, belongs_to_many), relationships that span multiple databases, nonstandard table names, and more.\n\nIf this example piqued your interest, continue on for all the gritty details.\n\n## Installation\n\n### Environment Requirements\n| Python Version | Supported          |\n| -------------- | ------------------ |\n| \u003c3.9           | :x:                |\n| \u003e=3.9          | :white_check_mark: |\n\nTo build from source, clone this repository and install a live, development version with pip:\n\n`pip3 install -e [PyLite_repo_directory]`\n\n## Distribution\n\nTo build a distribution, run the following command from the root directory of the project:\n`python3 -m build --sdist .`\n\nThen, use Twine to upload the distribution to PyPI: https://twine.readthedocs.io/en/latest/\n\n### Run Tests\n\n`coverage run --omit=\"*/tests/*\" -m pytest tests`\n\n`coverage report --show-missing`\n\n## Documentation\n\nDocumentation is hosted on GitHub, coming soon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhmoore%2Fpylite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenhmoore%2Fpylite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhmoore%2Fpylite/lists"}