{"id":21435499,"url":"https://github.com/gusibi/dynamodb-py","last_synced_at":"2025-08-02T09:32:41.068Z","repository":{"id":143141201,"uuid":"78863423","full_name":"gusibi/dynamodb-py","owner":"gusibi","description":"dynamodb-py 是为Amazon's DynamoDB 写的ORM，基于boto3","archived":false,"fork":false,"pushed_at":"2019-02-11T05:21:03.000Z","size":833,"stargazers_count":12,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T16:30:02.645Z","etag":null,"topics":["amazon-dynamodb","database","dynamodb","nosql","orm","python"],"latest_commit_sha":null,"homepage":"http://gusibi.github.io/tags/dynamodb/","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/gusibi.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":"2017-01-13T15:53:50.000Z","updated_at":"2020-04-11T04:18:53.000Z","dependencies_parsed_at":"2023-04-03T13:48:53.461Z","dependency_job_id":null,"html_url":"https://github.com/gusibi/dynamodb-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gusibi/dynamodb-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusibi%2Fdynamodb-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusibi%2Fdynamodb-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusibi%2Fdynamodb-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusibi%2Fdynamodb-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gusibi","download_url":"https://codeload.github.com/gusibi/dynamodb-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gusibi%2Fdynamodb-py/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268362937,"owners_count":24238542,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"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":["amazon-dynamodb","database","dynamodb","nosql","orm","python"],"created_at":"2024-11-22T23:44:24.379Z","updated_at":"2025-08-02T09:32:41.056Z","avatar_url":"https://github.com/gusibi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## dynamodb-py\n\ndynamodb-py is an ORM for Amazon's DynamoDB for Python applications. It provides similar functionality to ActiveRecord and improves on Amazon's existing HashModel by providing better searching tools and native association support.\n\nDynamoDB is not like other document-based databases you might know, and is very different indeed from relational databases. It sacrifices anything beyond the simplest relational queries and transactional support to provide a fast, cost-efficient, and highly durable storage solution. If your database requires complicated relational queries and transaction support, then this modest Gem cannot provide them for you, and neither can DynamoDB. In those cases you would do better to look elsewhere for your database needs.\n\n## Requires\n\n```\n* boto3\n* pytz\n* dateutil\n* simplejson\n```\n\n## Installation\n\n```\npip install git+https://github.com/gusibi/dynamodb-py.git@master\n```\n\n## Setup\n\n## Table\n\nynamodb-py has some sensible defaults for you when you create a new table, including the table name and the primary key column. But you can change those if you like on table creation.\n\n```\nfrom dynamodb.model import Model\nfrom dynamodb.fields import CharField, IntegerField, FloatField, DictField\nfrom dynamodb.table import Table\n\nclass Movies(Model):\n\n    __table_name__ = 'Movies'\n\n    ReadCapacityUnits = 10\n    WriteCapacityUnits = 10\n\n    year = IntegerField(name='year', hash_key=True)\n    title = CharField(name='title', range_key=True)\n    rating = FloatField(name='rating', indexed=True)\n    rank = IntegerField(name='rank', indexed=True)\n    release_date = CharField(name='release_date')\n    info = DictField(name='info', default={})\n\n# create_table\nTable(Movies()).create()\n\n# update_table\nTable(Movies()).update()\n\n# delete_table\nTable(Movies()).delete()\n```\n\n## Fields\nYou'll have to define all the fields on the model and the data type of each field. Every field on the object must be included here; if you miss any they'll be completely bypassed during DynamoDB's initialization and will not appear on the model objects.\n\n#### IntegerField\n\nStores an int. \n\n#### DateTimeField\n\nCan store a TimeDelta object. Saved in DynamoDB as a ISO 8601 string.\n\n#### DateField\n\nCan store a TimeDelta object. Saved in DynamoDB as a ISO 8601 string.\n\n#### TimeDeltaField\n\nCan store a TimeDelta object. Saved in DynamoDB as a ISO 8601 string.\n\n#### FloatField\n\nCan store floats.\n\n#### BooleanField\n\nCan store bools. Saved in dynamodb as False and True.\n\n#### ListField\n\nCan store a list of unicode, int, float, as well as other dynamodb-py models.\n\n#### DictField\n\nCan store a dict. \n\n```python\nclass Movies(Model):\n\n    __table_name__ = 'Movies'\n\n    ReadCapacityUnits = 10\n    WriteCapacityUnits = 10\n\n    year = IntegerField(name='year', hash_key=True)\n    title = CharField(name='title', range_key=True)\n    rating = FloatField(name='rating', indexed=True)\n    rank = IntegerField(name='rank', indexed=True)\n    release_date = CharField(name='release_date')\n    info = DictField(name='info', default={})\n```\n\nYou can optionally set a default value on a field using either a plain value or a lambda\n\n\n## Usage\n\n[Example](https://github.com/gusibi/dynamodb-py/tree/master/examples)\n\n## Querying\n\n```python\n# query without index\nitems = Movies.query().where(Movies.year.eq(year)).all()\nitems = Movies.query().where(Movies.year.eq(1985)).limit(10).all()\nitems = (Movies.query()\n\t\t.where(Movies.year.eq(1992),\n\t\t\t   Movies.title.between('A', 'L'))\n\t\t.all())\n\n# query with index\nitems = (Movies.query()\n\t\t.where(Movies.year.eq(1992),\n\t\t\t   Movies.title.between('A', 'L'))\n\t\t.order_by(Movies.rating, asc=False)\n\t\t.all())\n```\n\n## Credits\n\ndynamodb borrows code, structure, and even its name very liberally from the truly amazing Dynamoid and redisco.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusibi%2Fdynamodb-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgusibi%2Fdynamodb-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusibi%2Fdynamodb-py/lists"}