{"id":24055791,"url":"https://github.com/theonlyamos/odbms","last_synced_at":"2026-02-08T15:31:08.409Z","repository":{"id":63310577,"uuid":"566911162","full_name":"theonlyamos/odbms","owner":"theonlyamos","description":"Python Package for Managing both Relations and Non-Relational Databases","archived":false,"fork":false,"pushed_at":"2025-06-17T09:12:11.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T16:50:05.601Z","etag":null,"topics":["database","mongodb","mysql","postgresql","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theonlyamos.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}},"created_at":"2022-11-16T17:12:27.000Z","updated_at":"2025-06-11T18:15:47.000Z","dependencies_parsed_at":"2024-01-01T00:44:43.594Z","dependency_job_id":"8dece025-6b4c-44d4-8717-dd5fa27ac7c5","html_url":"https://github.com/theonlyamos/odbms","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"bc83f116b0242dc341e87c602ad5964467ece497"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/theonlyamos/odbms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theonlyamos%2Fodbms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theonlyamos%2Fodbms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theonlyamos%2Fodbms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theonlyamos%2Fodbms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theonlyamos","download_url":"https://codeload.github.com/theonlyamos/odbms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theonlyamos%2Fodbms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29235223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T14:18:14.570Z","status":"ssl_error","status_checked_at":"2026-02-08T14:18:14.071Z","response_time":57,"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":["database","mongodb","mysql","postgresql","python"],"created_at":"2025-01-09T04:30:59.541Z","updated_at":"2026-02-08T15:31:08.372Z","avatar_url":"https://github.com/theonlyamos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ODBMS - Object Document/Relational Mapping System\n\nA flexible and modern Python ORM supporting multiple databases (MongoDB, PostgreSQL, MySQL) with both synchronous and asynchronous operations.\n\n## Features\n\n- Support for multiple databases:\n  - SQLite (using sqlite3)\n  - MongoDB (using Motor)\n  - PostgreSQL (using aiopg)\n  - MySQL (using aiomysql)\n- Both synchronous and asynchronous operations\n- Connection pooling for better performance\n- Type-safe field definitions\n- Pydantic integration for validation\n- Automatic table/collection creation\n- Relationship handling\n- Computed fields\n- Flexible query interface\n\n## Installation\n\n```bash\npip install -r requirements.txt\n```\n\n## Quick Start\n\n```python\nfrom odbms import Model, StringField, IntegerField, EmailField\nfrom odbms.dbms import DBMS\n\n# Initialize database connection\nDBMS.initialize(\n    dbms='postgresql',  # or 'mongodb', 'mysql'\n    host='localhost',\n    port=5432,\n    database='mydb',\n    username='user',\n    password='pass'\n)\n\n# Define your model\nclass User(Model):\n    name: str = StringField()\n    email: str = EmailField()\n    age: int = IntegerField(min_value=0)\n\n# Create a new user\nuser = User(name='John Doe', email='john@example.com', age=30)\nawait user.save_async()  # or user.save() for sync operation\n\n# Find users\nusers = await User.find_async({'age': {'$gte': 25}})  # or User.find() for sync\n```\n\n## Field Types\n\n- `StringField`: For text data\n- `IntegerField`: For integer values\n- `FloatField`: For floating-point numbers\n- `BooleanField`: For true/false values\n- `DateTimeField`: For timestamps\n- `EmailField`: For email addresses with validation\n- `IDField`: For primary keys/IDs\n- `ComputedField`: For dynamically computed values\n- `ListField`: For arrays/lists\n- `DictField`: For nested documents/objects\n\n## Database Operations\n\n### Synchronous Operations\n\n```python\n# Create\nuser = User(name='John', email='john@example.com')\nuser.save()\n\n# Read\nuser = User.find_one({'email': 'john@example.com'})\nusers = User.find({'age': {'$gte': 25}})\nall_users = User.all()\n\n# Update\nUser.update({'age': {'$lt': 18}}, {'is_minor': True})\n\n# Delete\nUser.remove({'status': 'inactive'})\n\n# Aggregation\ntotal_age = User.sum('age', {'country': 'US'})\n```\n\n### Asynchronous Operations\n\n```python\n# Create\nuser = User(name='Jane', email='jane@example.com')\nawait user.save_async()\n\n# Read\nuser = await User.find_one_async({'email': 'jane@example.com'})\nusers = await User.find_async({'age': {'$gte': 25}})\nall_users = await User.all_async()\n\n# Update\nawait User.update_async({'age': {'$lt': 18}}, {'is_minor': True})\n\n# Delete\nawait User.remove_async({'status': 'inactive'})\n\n# Aggregation\ntotal_age = await User.sum_async('age', {'country': 'US'})\n```\n\n## Relationships\n\n```python\nclass Post(Model):\n    title: str = StringField()\n    content: str = StringField()\n    author_id: str = IDField()\n\nclass User(Model):\n    name: str = StringField()\n    posts: List[Post] = ListField(model=Post)\n\n# Create related records\nuser = User(name='John')\nawait user.save_async()\n\npost = Post(title='Hello', content='World', author_id=user.id)\nawait post.save_async()\n\n# Access relationships\nuser_posts = await user.posts  # Automatically fetches related posts\n```\n\n## Testing\n\nRun the test suite:\n\n```bash\npytest tests/\n```\n\nThe test suite includes comprehensive tests for:\n\n- All database operations (CRUD)\n- Both sync and async operations\n- Field validations\n- Relationships\n- Computed fields\n- Aggregations\n\n## Requirements\n\n- Python 3.7+\n- pydantic \u003e= 2.0.0\n- motor \u003e= 3.3.0 (for MongoDB)\n- aiopg \u003e= 1.4.0 (for PostgreSQL)\n- aiomysql \u003e= 0.2.0 (for MySQL)\n- inflect \u003e= 5.0.0\n- python-dotenv \u003e= 0.19.0\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheonlyamos%2Fodbms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheonlyamos%2Fodbms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheonlyamos%2Fodbms/lists"}