{"id":28466183,"url":"https://github.com/alessio-signorini/activerecord-archiver","last_synced_at":"2026-05-09T00:02:08.770Z","repository":{"id":38295307,"uuid":"165154646","full_name":"alessio-signorini/activerecord-archiver","owner":"alessio-signorini","description":"Library/Utility to Periodically Archive ActiveRecords entries in permanent storage","archived":false,"fork":false,"pushed_at":"2022-10-06T06:24:49.000Z","size":18,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T21:37:28.689Z","etag":null,"topics":["activerecord","archive","gem","json","rails","ruby","s3"],"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/alessio-signorini.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}},"created_at":"2019-01-11T00:57:10.000Z","updated_at":"2019-08-09T17:46:56.000Z","dependencies_parsed_at":"2023-01-19T09:00:51.365Z","dependency_job_id":null,"html_url":"https://github.com/alessio-signorini/activerecord-archiver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alessio-signorini/activerecord-archiver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio-signorini%2Factiverecord-archiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio-signorini%2Factiverecord-archiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio-signorini%2Factiverecord-archiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio-signorini%2Factiverecord-archiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessio-signorini","download_url":"https://codeload.github.com/alessio-signorini/activerecord-archiver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio-signorini%2Factiverecord-archiver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32802533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"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":["activerecord","archive","gem","json","rails","ruby","s3"],"created_at":"2025-06-07T06:08:42.103Z","updated_at":"2026-05-09T00:02:08.733Z","avatar_url":"https://github.com/alessio-signorini.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveRecord::Archiver\n\n**Easy to use gem to archive ActiveRecord objects to permanent storage.**\n\nWith the proliferation of data science and data platforms there is a growing\nneed to move data that was historically kept in siloed database into a single\ncommon storage where analysis can then be performed. This gem tries to help\nwith that task, requiring as little configuration as possible.\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activerecord-archiver'\n```\n\nand then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install activerecord-archiver\n\n## Configuration\n\nCreate a `config/archiver.yml` file with a configuration similar to the\nfollowing:\n```yaml\nstorage:\n  type: S3\n  bucket: test_bucket\n  prefix: 'first/second/%s'\n  path: '%Y/%m/%d/%s.%6N.json.gz'\n  options:\n    access_key_id: 'A'\n    secret_access_key: 'B'\n\ncollections:\n  - connections\n  - events:\n    track_by: updated_at\n    model: Activity\n    starting_at: '2019-01-01'\n```\n\n#### Storage\nThe only storage type supported at the moment is Amazon **`S3`**. Items will be\nconverted to JSON, saved into separated lines, and GZIP-ed. Here are some\nconfiguration instructions:\n* `bucket` (**required**) - the bucket into which to write\n* `prefix` (optional) - this string will be prefixed to the final path of each\n  file created. If it contains `%s` it will be substituted with the name of\n  the collection (e.g., `connections` or `events`).\n* `path` (optional) - this string will be passed to `Time.now.strftime` and the\n  results will be appended to the path. By default it is `%Y/%m/%d/%s.%6N.json`.\n* `option` (optional) - anything added there will be used as-is in the\ninitialization of the `AWS::S3::Client`. You are encouraged to look at the\n[official documentation](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Client.html#initialize-instance_method)\nto learn how to correctly configure the credentials (e.g., `options` can be\nomitted if you have AWS credentials setup in `ENV`).\n\n#### Collections\nEach entry in `collections` represent a model to archive. It can be a simple\nlist of names (e.g., `connections`, `events`) and default options will be used\n(e.g., the model class name will be inferred to be the singular version of\nthe name) or each entry can be configured with:\n* `track_by` - the key to use as iteration, by default it is `id` but anything\n  incremental will do (e.g., `updated_at`)\n* `model` - if the entry name does not represent the class you can use this\n  option to specify the real class name\n* `starting_at` - if you do not want to start from the beginning, specify here\n  the value of `track_by` to start from (e.g., `12345` or `2019-01-01`)\n\n## Usage\n\nOnce the configuration file is in place and the gem is required running\n\n    ActiveRecord::Archiver.archive\n\nis all you need. If you prefer to only archive one collection, pass its name\nas parameter, e.g.,\n\n    ActiveRecord::Archiver.archive('events')\n\nIt is recommended running it in a background thread (e.g.,\n[Sidekiq](https://github.com/mperham/sidekiq) or\n[ActiveJob](https://guides.rubyonrails.org/active_job_basics.html)). Since it\nperforms lots of `.to_json` operations it is also recommended to use a fast\nJSON encoder/decoder (e.g., [OJ](https://github.com/ohler55/oj))\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then,\nrun `rake test` to run the tests. You can also run `bin/console` for an\ninteractive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\nTo release a new version, update the version number in `version.rb`, and then\nrun `bundle exec rake release`, which will create a git tag for the version,\npush git commits and tags, and push the `.gem` file\nto [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\n```\nhttps://github.com/alessio-signorini/activerecord-archiver\n```\nThis project is intended to be a safe, welcoming space for collaboration, and\ncontributors are expected to adhere to the\n[Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of\nthe [MIT License](https://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessio-signorini%2Factiverecord-archiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessio-signorini%2Factiverecord-archiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessio-signorini%2Factiverecord-archiver/lists"}