{"id":15896215,"url":"https://github.com/numberoverzero/bloop","last_synced_at":"2025-04-11T19:05:01.189Z","repository":{"id":26505085,"uuid":"29957625","full_name":"numberoverzero/bloop","owner":"numberoverzero","description":"Object Mapper for DynamoDB","archived":false,"fork":false,"pushed_at":"2024-06-21T03:37:11.000Z","size":2264,"stargazers_count":58,"open_issues_count":6,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-25T14:51:19.066Z","etag":null,"topics":["aws","aws-sdk","dynamodb","python"],"latest_commit_sha":null,"homepage":"http://bloop.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/numberoverzero.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","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":"2015-01-28T08:24:29.000Z","updated_at":"2024-10-15T03:01:02.000Z","dependencies_parsed_at":"2024-10-28T16:32:58.723Z","dependency_job_id":null,"html_url":"https://github.com/numberoverzero/bloop","commit_stats":{"total_commits":1439,"total_committers":5,"mean_commits":287.8,"dds":0.006949270326615742,"last_synced_commit":"89e8bf923351c94ad5ec7a2c3b60ef6de95637f5"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbloop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbloop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbloop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbloop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numberoverzero","download_url":"https://codeload.github.com/numberoverzero/bloop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980848,"owners_count":21027809,"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","aws-sdk","dynamodb","python"],"created_at":"2024-10-06T09:06:56.004Z","updated_at":"2025-04-11T19:05:01.145Z","avatar_url":"https://github.com/numberoverzero.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://readthedocs.org/projects/bloop/badge?style=flat-square\n    :target: http://bloop.readthedocs.org/\n.. image:: https://img.shields.io/travis/numberoverzero/bloop/master.svg?style=flat-square\n    :target: https://travis-ci.org/numberoverzero/bloop\n.. image:: https://img.shields.io/gitter/room/numberoverzero/bloop.svg?style=flat-square\n    :target: https://gitter.im/numberoverzero/bloop\n.. image:: https://img.shields.io/pypi/v/bloop.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/bloop\n\nBloop is an object mapper for DynamoDB and DynamoDBStreams.\n\nRequires Python 3.6+\n\n::\n\n    pip install bloop\n\n=======\n Usage\n=======\n\nFirst, we need to import all the things:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from bloop import (\n    ...     BaseModel, Boolean, Column, String, UUID,\n    ...     GlobalSecondaryIndex, Engine\n    ... )\n\nNext we'll define the account model (with streaming enabled), and create the backing table:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e class Account(BaseModel):\n    ...     class Meta:\n    ...         stream = {\n    ...             \"include\": {\"old\", \"new\"}\n    ...         }\n    ...     id = Column(UUID, hash_key=True)\n    ...     name = Column(String)\n    ...     email = Column(String)\n    ...     by_email = GlobalSecondaryIndex(projection='keys', hash_key='email')\n    ...     verified = Column(Boolean, default=False)\n    ...\n    \u003e\u003e\u003e engine = Engine()\n    \u003e\u003e\u003e engine.bind(Account)\n\nLet's make a few users and persist them:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import uuid\n    \u003e\u003e\u003e admin = Account(id=uuid.uuid4(), email=\"admin@domain.com\")\n    \u003e\u003e\u003e admin.name = \"Admin McAdminFace\"\n    \u003e\u003e\u003e support = Account(name=\"this-is-fine.jpg\", email=\"help@domain.com\")\n    \u003e\u003e\u003e support.id = uuid.uuid4()\n    \u003e\u003e\u003e engine.save(admin, support)\n\nOr do the same in a transaction:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e with engine.transaction() as tx:\n    ...     tx.save(admin)\n    ...     tx.save(support)\n    ...\n    \u003e\u003e\u003e\n\nAnd find them again:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e q = engine.query(\n    ...     Account.by_email,\n    ...     key=Account.email==\"help@domain.com\"\n    ... )\n    \u003e\u003e\u003e q.first()\n    Account(email='help@domain.com',\n            id=UUID('d30e343f-f067-4fe5-bc5e-0b00cdeaf2ba'),\n            verified=False)\n\n.. code-block:: python\n\n    \u003e\u003e\u003e s = engine.scan(\n    ...     Account,\n    ...     filter=Account.name.begins_with(\"Admin\")\n    ... )\n    \u003e\u003e\u003e s.one()\n    Account(email='admin@domain.com',\n            id=UUID('08da44ac-5ff6-4f70-8a3f-b75cadb4dd79'),\n            name='Admin McAdminFace',\n            verified=False)\n\nLet's find them in the stream:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e stream = engine.stream(Account, \"trim_horizon\")\n    \u003e\u003e\u003e next(stream)\n    {'key': None,\n     'meta': {'created_at': datetime.datetime(...),\n      'event': {'id': 'cbb9a9b45eb0a98889b7da85913a5c65',\n       'type': 'insert',\n       'version': '1.1'},\n      'sequence_number': '100000000000588052489'},\n     'new': Account(\n                email='help@domain.com',\n                id=UUID('d30e343f-...-0b00cdeaf2ba'),\n                name='this-is-fine.jpg',\n                verified=False),\n     'old': None}\n    \u003e\u003e\u003e next(stream)\n    {'key': None,\n     'meta': {'created_at': datetime.datetime(...),\n      'event': {'id': 'cbdfac5671ea38b99017c4b43a8808ce',\n       'type': 'insert',\n       'version': '1.1'},\n      'sequence_number': '200000000000588052506'},\n     'new': Account(\n                email='admin@domain.com',\n                id=UUID('08da44ac-...-b75cadb4dd79'),\n                name='Admin McAdminFace',\n                verified=False),\n     'old': None}\n    \u003e\u003e\u003e next(stream)\n    \u003e\u003e\u003e next(stream)\n    \u003e\u003e\u003e\n\n=============\n What's Next\n=============\n\nCheck out the `User Guide`_ or `Public API Reference`_ to create your own nested types, overlapping models,\nset up cross-region replication in less than 20 lines, and more!\n\n.. _User Guide: https://bloop.readthedocs.io/en/latest/user/quickstart.html\n.. _Public API Reference: https://bloop.readthedocs.io/en/latest/api/public.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberoverzero%2Fbloop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumberoverzero%2Fbloop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberoverzero%2Fbloop/lists"}