{"id":39749242,"url":"https://github.com/davidkelley/rom-dynamodb","last_synced_at":"2026-01-18T11:24:08.261Z","repository":{"id":56892611,"uuid":"78831039","full_name":"davidkelley/rom-dynamodb","owner":"davidkelley","description":"ROM DynamoDB Adapter","archived":false,"fork":false,"pushed_at":"2017-12-22T18:00:16.000Z","size":51,"stargazers_count":6,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-08T04:53:19.501Z","etag":null,"topics":["aws","dynamodb","gem","rom","rom-dynamodb","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/davidkelley.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-13T08:37:56.000Z","updated_at":"2023-03-05T02:42:07.000Z","dependencies_parsed_at":"2022-08-21T00:50:58.716Z","dependency_job_id":null,"html_url":"https://github.com/davidkelley/rom-dynamodb","commit_stats":null,"previous_names":["davidkelley/rom-dynamo"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/davidkelley/rom-dynamodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkelley%2From-dynamodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkelley%2From-dynamodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkelley%2From-dynamodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkelley%2From-dynamodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidkelley","download_url":"https://codeload.github.com/davidkelley/rom-dynamodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkelley%2From-dynamodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["aws","dynamodb","gem","rom","rom-dynamodb","ruby"],"created_at":"2026-01-18T11:24:08.187Z","updated_at":"2026-01-18T11:24:08.251Z","avatar_url":"https://github.com/davidkelley.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ROM DynamoDB Adapter\n [![Gem Version](https://badge.fury.io/rb/rom-dynamodb.svg)](https://badge.fury.io/rb/rom-dynamodb) [![GitHub](https://img.shields.io/badge/github-davidkelley%2From--dynamo-blue.svg)](https://github.com/davidkelley/rom-dynamodb) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/github/davidkelley/rom-dynamodb) [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)  [![Gitter](http://img.shields.io/badge/gitter-rom--rb-red.svg)](https://gitter.im/rom-rb/chat)\n\n [![Code Climate](https://codeclimate.com/github/davidkelley/rom-dynamodb/badges/gpa.svg)](https://codeclimate.com/github/davidkelley/rom-dynamodb) [![Coverage Status](https://coveralls.io/repos/github/davidkelley/rom-dynamodb/badge.svg?branch=master)](https://coveralls.io/github/davidkelley/rom-dynamodb?branch=master) [![Dependency Status](https://gemnasium.com/badges/github.com/davidkelley/rom-dynamodb.svg)](https://gemnasium.com/github.com/davidkelley/rom-dynamodb)\n [![Build Status](https://travis-ci.org/davidkelley/rom-dynamodb.svg?branch=master)](https://travis-ci.org/davidkelley/rom-dynamodb) [![Inline docs](http://inch-ci.org/github/davidkelley/rom-dynamodb.svg?branch=master)](http://inch-ci.org/github/davidkelley/rom-dynamodb)\n\n---\n\nThis adapter uses [ROM (\u003e= 2.0.0)](http://rom-rb.org/) to provide an easy-to-use, clean and understandable interface for [AWS DynamoDB](https://aws.amazon.com/documentation/dynamodb/).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rom-dynamodb'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rom-dynamodb\n\n## Usage\n\nThe following container setup is for demonstration purposes only. You should follow the standard way of integrating ROM into your environment, as [documented here](http://rom-rb.org/learn/advanced/flat-style-setup/).\n\n```ruby\nrequire 'rom/dynamodb'\n\nTABLE = \"my-dynamodb-users-table\"\n\n# any other AWS::DynamoDB::Client options\ncredentials = { region: 'us-east-1' }\n\ncontainer = ROM.container(:dynamodb, credentials) do |rom|\n  rom.relation(:users) do\n    # Key Schema: id\u003cHash\u003e\n    dataset TABLE\n\n    def by_id(val)\n      where { id == val }\n    end\n  end\n\n  rom.commands(:users) do\n    FILTER = Functions[:symbolize_keys] \u003e\u003e Functions[:accept_keys, [:id]]\n\n    define(:create) do\n      KEYS = %w(id name)\n      result :one\n      input Functions[:accept_keys, KEYS]\n    end\n\n    define(:delete) do\n      result :one\n      input FILTER\n    end\n\n    define(:update) do\n      result :one\n      input FILTER\n    end\n  end\nend\n\nrelation = container.relation(:users)\n\nrelation.count # =\u003e 1234\n\nrelation.where { id == 1 }.one! # =\u003e { id: 1, name: \"David\" }\n\nrelation.info # =\u003e \u003cHash\u003e DynamoDB Table Information\n\nrelation.status # =\u003e :active\n\n# create a new user\ncreate = container.commands[:users][:create]\nuser = create.call({ id: 2, name: \"James\" })\n\n# update an existing user\nupdate = container.commands[:users][:update]\nupdate.by_id(user[:id]).call(name: \"Mark\")\n\nrelation.where(id: user[:id]) { id == id }.one! # =\u003e { id: 2, name: \"Mark\" }\n\n# delete an existing user\ndelete = container.commands[:users][:delete]\ndelete.by_id(user[:id]).call\n```\n---\n\n#### Querying a composite key DynamoDB Table\n\n```ruby\ncontainer = ROM.container(:dynamodb, credentials) do |rom|\n  rom.relation(:logs) do\n    # Key Schema: host\u003cHash\u003e, timestamp\u003cRange\u003e\n    dataset \"my-logs-table\"\n\n    def by_host(ip)\n      where { host == ip }\n    end\n\n    def after_timestamp(time)\n      where { timestamp \u003e time }\n    end\n\n    def before_timestamp(time)\n      where { timestamp \u003c time }\n    end\n  end\n\n  rom.commands(:logs) do\n    define(:create) do\n      KEYS = %w(host timestamp message)\n      result :one\n      input Functions[:accept_keys, KEYS]\n    end\n  end\nend\n\nnum_of_logs = 20\n\nhost = \"192.168.0.1\"\n\nlogs = (1..num_of_logs).to_a.collect do |i|\n  { host: host, timestamp: Time.now.to_f + (i * 60), message: \"some message\" }\nend\n\n# create fake logs\ncontainer.commands[:logs][:create].call(logs)\n\nrelation = container.relation(:logs)\n\nrelation.count == num_of_logs # =\u003e true\n\nall = relation.where(ip: host) { host == ip }.after(0).to_a # =\u003e [{host: \"192.168.0.1\", ... }, ...]\n\nall.size # =\u003e 20\n\nbefore = relation.where(ip: host) { [host == ip, timestamp \u003c (Time.now.to_f + 60 * 60)] }.limit(1).to_a\n\nbefore.size # =\u003e 1\n\nbefore.first == logs.first # =\u003e true\n\noffset = { ip: host, timestamp: logs[-2][:timestamp] }\n\nlast = relation.where(ip: host) { ip == host }.descending.after(0).offset(offset).limit(1).one!\n\nlast == logs.last # =\u003e true\n```\n---\n\n## Development\n\nAll development takes place inside [Docker Compose](). Run the following commands to get setup:\n\n```\n$ docker-compose pull\n$ docker-compose build\n```\n\nYou can then begin developing, running RSpec tests with the following command:\n\n```\n$ docker-compose run rom rspec [args...]\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/davidkelley/rom-dynamo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkelley%2From-dynamodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidkelley%2From-dynamodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkelley%2From-dynamodb/lists"}