{"id":22017336,"url":"https://github.com/pynamodb/pynamodb","last_synced_at":"2025-05-14T22:03:19.535Z","repository":{"id":13371235,"uuid":"16058979","full_name":"pynamodb/PynamoDB","owner":"pynamodb","description":"A pythonic interface to Amazon's DynamoDB","archived":false,"fork":false,"pushed_at":"2025-01-24T21:37:46.000Z","size":2661,"stargazers_count":2500,"open_issues_count":297,"forks_count":432,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-05-05T04:37:27.539Z","etag":null,"topics":["aws","dynamodb","python"],"latest_commit_sha":null,"homepage":"http://pynamodb.readthedocs.io","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/pynamodb.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"docs/contributing.rst","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":"2014-01-20T02:18:35.000Z","updated_at":"2025-04-26T13:10:46.000Z","dependencies_parsed_at":"2024-04-28T01:56:33.664Z","dependency_job_id":"7e4abb72-d876-4553-a23b-78ba3e0029b9","html_url":"https://github.com/pynamodb/PynamoDB","commit_stats":{"total_commits":764,"total_committers":109,"mean_commits":7.009174311926605,"dds":0.6047120418848168,"last_synced_commit":"0cf2e945c2a325734f2170d2a85940a0e735e5f3"},"previous_names":["jlafon/pynamodb"],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pynamodb%2FPynamoDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pynamodb%2FPynamoDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pynamodb%2FPynamoDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pynamodb%2FPynamoDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pynamodb","download_url":"https://codeload.github.com/pynamodb/PynamoDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252840406,"owners_count":21812301,"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":["aws","dynamodb","python"],"created_at":"2024-11-30T05:05:59.107Z","updated_at":"2025-05-07T08:24:19.732Z","avatar_url":"https://github.com/pynamodb.png","language":"Python","readme":"========\nPynamoDB\n========\n\n.. image:: https://img.shields.io/pypi/v/pynamodb.svg\n    :target: https://pypi.python.org/pypi/pynamodb/\n.. image:: https://img.shields.io/conda/vn/conda-forge/pynamodb.svg\n    :target: https://anaconda.org/conda-forge/pynamodb\n.. image:: https://github.com/pynamodb/PynamoDB/workflows/Tests/badge.svg\n    :target: https://github.com/pynamodb/PynamoDB/actions\n.. image:: https://img.shields.io/coveralls/pynamodb/PynamoDB/master.svg\n    :target: https://coveralls.io/github/pynamodb/PynamoDB\n\nA Pythonic interface for Amazon's `DynamoDB \u003chttps://aws.amazon.com/dynamodb/\u003e`_.\n\nDynamoDB is a great NoSQL service provided by Amazon, but the API is verbose.\nPynamoDB presents you with a simple, elegant API.\n\nUseful links:\n\n* See the full documentation at https://pynamodb.readthedocs.io/\n* Ask questions in the `GitHub issues \u003chttps://github.com/pynamodb/PynamoDB/issues\u003e`_\n* See release notes at https://pynamodb.readthedocs.io/en/latest/release_notes.html\n\nInstallation\n============\nFrom PyPi::\n\n    $ pip install pynamodb\n\nFrom GitHub::\n\n    $ pip install git+https://github.com/pynamodb/PynamoDB#egg=pynamodb\n\nFrom conda-forge::\n\n    $ conda install -c conda-forge pynamodb\n\n\nBasic Usage\n===========\n\nCreate a model that describes your DynamoDB table.\n\n.. code-block:: python\n\n    from pynamodb.models import Model\n    from pynamodb.attributes import UnicodeAttribute\n\n    class UserModel(Model):\n        \"\"\"\n        A DynamoDB User\n        \"\"\"\n        class Meta:\n            table_name = \"dynamodb-user\"\n        email = UnicodeAttribute(null=True)\n        first_name = UnicodeAttribute(range_key=True)\n        last_name = UnicodeAttribute(hash_key=True)\n\nPynamoDB allows you to create the table if needed (it must exist before you can use it!):\n\n.. code-block:: python\n\n    UserModel.create_table(read_capacity_units=1, write_capacity_units=1)\n\nCreate a new user:\n\n.. code-block:: python\n\n    user = UserModel(\"John\", \"Denver\")\n    user.email = \"djohn@company.org\"\n    user.save()\n\nNow, search your table for all users with a last name of 'Denver' and whose\nfirst name begins with 'J':\n\n.. code-block:: python\n\n    for user in UserModel.query(\"Denver\", UserModel.first_name.startswith(\"J\")):\n        print(user.first_name)\n\nExamples of ways to query your table with filter conditions:\n\n.. code-block:: python\n\n    for user in UserModel.query(\"Denver\", UserModel.email==\"djohn@company.org\"):\n        print(user.first_name)\n\nRetrieve an existing user:\n\n.. code-block:: python\n\n    try:\n        user = UserModel.get(\"John\", \"Denver\")\n        print(user)\n    except UserModel.DoesNotExist:\n        print(\"User does not exist\")\n\nUpgrade Warning\n===============\n\nThe behavior of 'UnicodeSetAttribute' has changed in backwards-incompatible ways\nas of the 1.6.0 and 3.0.1 releases of PynamoDB.\n\nSee `UnicodeSetAttribute upgrade docs \u003chttps://pynamodb.readthedocs.io/en/latest/release_notes.html\u003e`_\nfor detailed instructions on how to safely perform the upgrade.\n\nAdvanced Usage\n==============\n\nWant to use indexes? No problem:\n\n.. code-block:: python\n\n    from pynamodb.models import Model\n    from pynamodb.indexes import GlobalSecondaryIndex, AllProjection\n    from pynamodb.attributes import NumberAttribute, UnicodeAttribute\n\n    class ViewIndex(GlobalSecondaryIndex):\n        class Meta:\n            read_capacity_units = 2\n            write_capacity_units = 1\n            projection = AllProjection()\n        view = NumberAttribute(default=0, hash_key=True)\n\n    class TestModel(Model):\n        class Meta:\n            table_name = \"TestModel\"\n        forum = UnicodeAttribute(hash_key=True)\n        thread = UnicodeAttribute(range_key=True)\n        view = NumberAttribute(default=0)\n        view_index = ViewIndex()\n\nNow query the index for all items with 0 views:\n\n.. code-block:: python\n\n    for item in TestModel.view_index.query(0):\n        print(\"Item queried from index: {0}\".format(item))\n\nIt's really that simple.\n\n\nWant to use DynamoDB local? Just add a ``host`` name attribute and specify your local server.\n\n.. code-block:: python\n\n    from pynamodb.models import Model\n    from pynamodb.attributes import UnicodeAttribute\n\n    class UserModel(Model):\n        \"\"\"\n        A DynamoDB User\n        \"\"\"\n        class Meta:\n            table_name = \"dynamodb-user\"\n            host = \"http://localhost:8000\"\n        email = UnicodeAttribute(null=True)\n        first_name = UnicodeAttribute(range_key=True)\n        last_name = UnicodeAttribute(hash_key=True)\n\nWant to enable streams on a table? Just add a ``stream_view_type`` name attribute and specify\nthe type of data you'd like to stream.\n\n.. code-block:: python\n\n    from pynamodb.models import Model\n    from pynamodb.attributes import UnicodeAttribute\n    from pynamodb.constants import STREAM_NEW_AND_OLD_IMAGE\n\n    class AnimalModel(Model):\n        \"\"\"\n        A DynamoDB Animal\n        \"\"\"\n        class Meta:\n            table_name = \"dynamodb-user\"\n            host = \"http://localhost:8000\"\n            stream_view_type = STREAM_NEW_AND_OLD_IMAGE\n        type = UnicodeAttribute(null=True)\n        name = UnicodeAttribute(range_key=True)\n        id = UnicodeAttribute(hash_key=True)\n\nFeatures\n========\n\n* Python \u003e= 3.7 support\n* An ORM-like interface with query and scan filters\n* Compatible with DynamoDB Local\n* Supports the entire DynamoDB API\n* Support for Unicode, Binary, JSON, Number, Set, and UTC Datetime attributes\n* Support for Global and Local Secondary Indexes\n* Provides iterators for working with queries, scans, that are automatically paginated\n* Automatic pagination for bulk operations\n* Complex queries\n* Batch operations with automatic pagination\n* Iterators for working with Query and Scan operations\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpynamodb%2Fpynamodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpynamodb%2Fpynamodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpynamodb%2Fpynamodb/lists"}