{"id":37085343,"url":"https://github.com/basalam/backbone-orm","last_synced_at":"2026-01-14T10:29:26.490Z","repository":{"id":263249383,"uuid":"875664472","full_name":"basalam/backbone-orm","owner":"basalam","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-01T09:04:47.000Z","size":125,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-11-27T17:25:43.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/basalam.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-20T15:19:59.000Z","updated_at":"2025-10-01T09:04:01.000Z","dependencies_parsed_at":"2024-11-17T10:18:29.290Z","dependency_job_id":"e69c6d56-fe2b-4fc8-920a-cd6b0f3b6982","html_url":"https://github.com/basalam/backbone-orm","commit_stats":null,"previous_names":["basalam/backbone-orm"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/basalam/backbone-orm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basalam%2Fbackbone-orm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basalam%2Fbackbone-orm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basalam%2Fbackbone-orm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basalam%2Fbackbone-orm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basalam","download_url":"https://codeload.github.com/basalam/backbone-orm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basalam%2Fbackbone-orm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:25:19.714Z","status":"ssl_error","status_checked_at":"2026-01-14T10:22:49.371Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-14T10:29:26.005Z","updated_at":"2026-01-14T10:29:26.485Z","avatar_url":"https://github.com/basalam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Backbone ORM\nBackbone ORM is a lightweight, asynchronous Object-Relational Mapper (ORM) for Python, built on top of the PyPika SQL query builder. It provides a clean and efficient interface for interacting with PostgreSQL databases, leveraging type hints and asynchronous programming to enable scalable and maintainable database operations.\n\n#### Features\n- Asynchronous Support: Built with asyncio to support non-blocking database operations.\n- Type-Hinted Models: Utilizes Python's type hints for defining models, enhancing code clarity and editor support.\n- PostgreSQL Integration: Specifically designed for PostgreSQL databases, with support for connection pooling and schema management.\n- Redis Integration: Includes support for Redis, allowing for caching and other in-memory data storage solutions.\n- Flexible Querying: Provides a flexible query builder and supports soft deletes and model relationships.\n\n#### Requirements \n\n- python 3.10+\n- pypika 0.48+\n- pydantic 2.0+\n- basalam.backbone-redis-cache 0.0.11+\n\n#### Installation \u0026 Upgrade\n\n```shell\npip install basalam.backbone-orm --upgrade\n```\n\n### Usage\n\n#### Define Models\n```python\nfrom basalam.backbone_orm import ModelAbstract\n\nclass UserModel(ModelAbstract):\n    id: int\n    name: str\n\n```\n\n#### Create Repositories\n```python\nimport typing\nimport aioredis\nfrom basalam.backbone_orm import (\n    T,\n    DriverEnum,\n    PostgresManager,\n    ConnectionConfig,\n    RepositoryAbstract,\n)\n\npostgres = PostgresManager(\n    default=DriverEnum.POOL,\n    config=ConnectionConfig(...)\n)\n\nredis = aioredis.Redis(...)\n\n\nclass UserRepo(RepositoryAbstract[UserModel]):\n\n    @classmethod\n    async def connection(cls) -\u003e PostgresConnection:\n        return await postgres.acquire()\n\n    @classmethod\n    def redis(cls) -\u003e aioredis.Redis:\n        return redis\n\n    @classmethod\n    def table_name(cls) -\u003e str:\n        return \"users\"\n\n    @classmethod\n    def model(cls) -\u003e typing.Type[T]:\n        return UserModel\n\n    @classmethod\n    def soft_deletes(cls) -\u003e bool:\n        return True\n\n    @classmethod\n    def default_relations(cls) -\u003e typing.List[str]:\n        return []\n\n```\n\n#### Perform Queries\n```python\nuser = await UserRepo.find_by_id(1)\n```\n\n#### Testing\n\n```bash\n# install pytest\npip install pytest\n\n# run tests\npython -m pytest\n```\n\n#### Changelog\n\n- 0.0.11: Build and push process now handled by GitLab CI\n- 0.0.13: fix - Correct return type of `update_return` method\n- 0.0.14: Add support for custom order enums\n- 0.0.15: Introduce `has_relations` in `ModelAbstract`\n- 1.0.0: Introduce `QueryBuilder` and `Connection Manager`\n- 1.0.9: Extend `QueryBuilderAbstract` from PyPika's `PostgreSQLQueryBuilder`\n- 2.0.0: Drop support for Pydantic v1 and ensure compatibility with Pydantic v2\n- 2.0.6: Add `with_thrashed` option to `find_by_id` method\n- 2.0.14: Fix `dict` method in `ModelAbstract` for Pydantic v2 compatibility\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasalam%2Fbackbone-orm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasalam%2Fbackbone-orm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasalam%2Fbackbone-orm/lists"}