{"id":13878877,"url":"https://github.com/esminc/adhoq","last_synced_at":"2025-07-16T14:33:13.912Z","repository":{"id":21606886,"uuid":"24927153","full_name":"esminc/adhoq","owner":"esminc","description":"Rails engine to generate instant reports from adhoc SQL query.","archived":false,"fork":false,"pushed_at":"2022-06-28T05:14:20.000Z","size":873,"stargazers_count":110,"open_issues_count":12,"forks_count":26,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-10-31T15:18:31.601Z","etag":null,"topics":["rails-engine","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/esminc.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-08T06:12:34.000Z","updated_at":"2024-09-05T07:24:32.000Z","dependencies_parsed_at":"2022-08-05T13:34:19.700Z","dependency_job_id":null,"html_url":"https://github.com/esminc/adhoq","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Fadhoq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Fadhoq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Fadhoq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Fadhoq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esminc","download_url":"https://codeload.github.com/esminc/adhoq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226138849,"owners_count":17579496,"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":["rails-engine","ruby"],"created_at":"2024-08-06T08:02:02.979Z","updated_at":"2024-11-24T07:31:23.254Z","avatar_url":"https://github.com/esminc.png","language":"Ruby","funding_links":[],"categories":["SCSS"],"sub_categories":[],"readme":"Adhoq [![Build Status](https://travis-ci.org/esminc/adhoq.svg)](https://travis-ci.org/esminc/adhoq) [![Code Climate](https://codeclimate.com/github/esminc/adhoq/badges/gpa.svg)](https://codeclimate.com/github/esminc/adhoq) [![Test Coverage](https://codeclimate.com/github/esminc/adhoq/badges/coverage.svg)](https://codeclimate.com/github/esminc/adhoq/coverage)\n====\n\nRails engine to generate instant reports from adhoc SQL query.\n\n![adhoq](https://cloud.githubusercontent.com/assets/3419/4556639/7f06340a-4ecb-11e4-87c4-b074580e77f5.png)\n\n## Features\n\n- Export ad-hoc SQL reports in some formats:\n  - .csv\n  - .json\n  - .xlsx\n- Persist generated report as local file or in AWS S3\n- over Rails 5.1.X\n- Nice administration console with rails engine\n\n### Future planning\n\n- [ ] Label data substitution\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'adhoq'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install adhoq\n\n## Usage\n\n### As Rails engine\n\nInstall migrations\n\n```sh\n$ bundle exec rake adhoq:install:migrations\n$ bundle exec rake db:migrate\n```\n\nMount it in `config/routes.rb`\n\n```ruby\nRails.application.routes.draw do\n  root  to: 'hi#show'\n\n  mount Adhoq::Engine =\u003e \"/adhoq\"\nend\n```\n\nEdit initialization file in `config/initializers/adhoq.rb`\n\n```ruby\nAdhoq.configure do |config|\n  # if not set, use :on_the_fly.(default)\n  config.storage       = [:local_file, Rails.root + './path/to/store/report/files']\n  config.authorization = -\u003e(controller) { controller.signed_in? }\nend\n```\n\nSee configuration example in [dummy app](https://github.com/esminc/adhoq/blob/master/spec/dummy/config/initializers/adhoq.rb).\n\nThen restart server and try it out.\n\n### As Plain old library (application export helper)\n\nAdhoq also provides report generation from SQL string, not from mounted rails engine.\n\n```ruby\nexecution = Adhoq::AdhocExecution.new(\n  'xlsx',\n  'SELECT \"hello\" AS name ,\"English greeting message\" AS description'\n)\n\nAdhoq::Reporter.generate(execution) #=\u003e report data\n```\n\nPersistence is also available without engine via `Adhoq::Storage::SomeClass#store`.\nBelow is example that generating report and persist to in Rails application report method.\n\n```ruby\nexecution = Adhoq::AdhocExecution.new(\n  'xlsx',\n  'SELECT \"hello\" AS name ,\"English greeting message\" AS description'\n)\n\nstorage   = Storage::S3.new(\n  'my-adhoq-bucket',\n  aws_access_key_id: 'key_id',\n  aws_secret_access_key: 'access_key'\n)\n\n# generate report and store it to S3, returns `key` to get report data\nkey = storage.store('.xlsx') { Adhoq::Reporter.generate(execution) }\n\n...\nstorage.get(key) #=\u003e report data\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/esminc/adhoq/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesminc%2Fadhoq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesminc%2Fadhoq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesminc%2Fadhoq/lists"}