{"id":20230717,"url":"https://github.com/charlestaylor7/ormlite","last_synced_at":"2026-02-13T09:32:57.557Z","repository":{"id":178111642,"uuid":"661088956","full_name":"CharlesTaylor7/ormlite","owner":"CharlesTaylor7","description":"Two way binding from Python Dataclasses to Sqlite tables","archived":false,"fork":false,"pushed_at":"2024-11-09T13:30:32.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T07:45:52.425Z","etag":null,"topics":["dataclass","dataclasses","orm","orm-library","python","python3","sqlite","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/CharlesTaylor7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-01T18:51:05.000Z","updated_at":"2024-11-09T13:30:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7142293-022d-44ba-8d8f-18a537c61445","html_url":"https://github.com/CharlesTaylor7/ormlite","commit_stats":null,"previous_names":["charlestaylor7/ormlite"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesTaylor7%2Formlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesTaylor7%2Formlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesTaylor7%2Formlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesTaylor7%2Formlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlesTaylor7","download_url":"https://codeload.github.com/CharlesTaylor7/ormlite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233824656,"owners_count":18736037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dataclass","dataclasses","orm","orm-library","python","python3","sqlite","sqlite3"],"created_at":"2024-11-14T07:43:32.287Z","updated_at":"2026-02-13T09:32:57.498Z","avatar_url":"https://github.com/CharlesTaylor7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Read The Docs](https://ormlite.readthedocs.io/en/latest/)\n\n[PyPI](https://pypi.org/project/ormlite)\n\u003c!---\n[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)\n---\u003e\n\n# Usage\n\nInstall:\n```\npip install ormlite\n```\n\nSample code:\n```python3\nfrom datetime import datetime\nfrom ormlite import connect_to_sqlite, migrate, model, field, select, upsert\n\n@model('persons')\nclass Person:\n  email: str = field(pk=True)\n  age: int\n  height: str\n  last_seen: datetime = datetime.now()\n\ndb = connect_to_sqlite(\"demo.db\")\nmigrate(db)\n\nupsert(db, [Person('me@me.com', 23, \"5ft 10in\")], update=[])\nmodels = select(Person).where(\"age = '23'\").models(db)\nprint(list(models))\n# Output: [Person(email='me@me.com', age=23, height='5ft 10in', last_seen=datetime.datetime(...))]\n\ndb.close()\n```\n\n\n# Motivation\nI wanted to query a sqlite database, without writing verbose queries. Previously, for work, I've used django's orm for interacting with sql databases. But for a recent small personal project, I wanted a library to interact with sqlite without depending on an entire web framework.\n\nAfter I deciding to build my own library, I decided to embrace modern python idioms. So my library is built on top of the dataclasses library in the standard lib. \n\nTo keep scope small, ormlite only interops with sqlite, not other sql databases.\n\n# Use case\n\normlite operates off the principle, that your python source code is the source of truth for the state of the sql tables. Migrations are run in a single step, it checks for differences between your python tables and your sql database. Then it applies sql migrations immediately.\n\nDjango \u0026 Ruby on Rails, have a separate step whereby migrations are serialized to files. Migrations are thus shared across dev machines, and to production this way. \n\nSince ormlite doesn't do this, it's not suitable for production deployment or teams of devs.\n\nMy use case for the library involves running scripts on my local machine, so I enjoy not dealing with the hassle of an evergrowing list of migrations in my repo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlestaylor7%2Formlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlestaylor7%2Formlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlestaylor7%2Formlite/lists"}