• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rails engine to generate instant reports from adhoc SQL query.

Adhoq Build Status Code Climate Test Coverage

Rails engine to generate instant reports from adhoc SQL query.

adhoq

Features

  • Export ad-hoc SQL reports in some formats:
    • .csv
    • .json
    • .xlsx
  • Persist generated report as local file or in AWS S3
  • over Rails 5.1.X
  • Nice administration console with rails engine

Future planning

  • Label data substitution

Installation

Add this line to your application's Gemfile:

gem 'adhoq'

And then execute:

$ bundle

Or install it yourself as:

$ gem install adhoq

Usage

As Rails engine

Install migrations

$ bundle exec rake adhoq:install:migrations
$ bundle exec rake db:migrate

Mount it in config/routes.rb

Rails.application.routes.draw do
  root  to: 'hi#show'

  mount Adhoq::Engine => "/adhoq"
end

Edit initialization file in config/initializers/adhoq.rb

Adhoq.configure do |config|
  # if not set, use :on_the_fly.(default)
  config.storage       = [:local_file, Rails.root + './path/to/store/report/files']
  config.authorization = ->(controller) { controller.signed_in? }
end

See configuration example in dummy app.

Then restart server and try it out.

As Plain old library (application export helper)

Adhoq also provides report generation from SQL string, not from mounted rails engine.

execution = Adhoq::AdhocExecution.new(
  'xlsx',
  'SELECT "hello" AS name ,"English greeting message" AS description'
)

Adhoq::Reporter.generate(execution) #=> report data

Persistence is also available without engine via Adhoq::Storage::SomeClass#store. Below is example that generating report and persist to in Rails application report method.

execution = Adhoq::AdhocExecution.new(
  'xlsx',
  'SELECT "hello" AS name ,"English greeting message" AS description'
)

storage   = Storage::S3.new(
  'my-adhoq-bucket',
  aws_access_key_id: 'key_id',
  aws_secret_access_key: 'access_key'
)

# generate report and store it to S3, returns `key` to get report data
key = storage.store('.xlsx') { Adhoq::Reporter.generate(execution) }

...
storage.get(key) #=> report data

Contributing

  1. Fork it ( https://github.com/esminc/adhoq/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

More Repositories

1

tapp

tap { pp self }
Ruby
129
star
2

seory

Manage SEO contents in Rails app. based on controller, action and more complex context.
Ruby
42
star
3

kawaii_email_address

Extraction of validate logic from `validates_email_format_of` to support docomo addresses
Ruby
26
star
4

mvc_kata

mvc kata
Ruby
20
star
5

activejob-google_cloud_tasks-http

Active Job adapter for Google Cloud Tasks HTTP targets
Ruby
19
star
6

esm-overlay

ESM's portage overlay. It's useful for especially Ruby/Rails application development.
Shell
18
star
7

tarfs

Linux File System
C
14
star
8

gyomu_ruby

Ruby
13
star
9

deka_eiwakun

Ruby convention in esm
Ruby
12
star
10

faclet

faclet: Easily set up test data using FactoryGirl and let(RSpec)
Ruby
11
star
11

copipedential-ex

copy & paste your confidential information.
Ruby
8
star
12

pivotter

irc gateway for pivotal tracker activity webhook
Ruby
8
star
13

xpe2nd-reading

XPE2nd読書会@ESM
7
star
14

respond_supported_only

Support to defines Rails' controller filter that rejects request with unexpected `Accept:` header.
Ruby
7
star
15

CRUDViewTemplate

This tool is a CRUD base view template for Core Data on iPhone SDK.
Objective-C
6
star
16

lunchpack

永和システムマネジメント アジャイル事業部のランチ給付金制度の便利ツール
Ruby
6
star
17

qemu

C
6
star
18

ww

Double Web, Framework to build double Web server. Main deveropment repo is http://github.com/moro/ww
Ruby
6
star
19

narrative

Ruby
6
star
20

operate_do

Ruby
5
star
21

esminc.github.io

HTML
4
star
22

invite_new_member

Ruby
4
star
23

hash_traverse

Fetch nested hash value at ease
Ruby
4
star
24

bento

bento
Ruby
4
star
25

tapp-awesome_print

Add awesome_print support to tapp.
Ruby
4
star
26

mina-railsapp

Ruby
3
star
27

scrum

Project Management doesn't hurt.
3
star
28

s3_reproxy_download

Ruby
2
star
29

rubyagile

Ruby
2
star
30

jis_x_0401

Ruby
1
star
31

iphone

1
star
32

portage-prefix-overlay

Ruby
1
star
33

anpikun

Ruby
1
star
34

frerela

Python
1
star
35

rails-docker-examples

Examples for development environment with Docker Compose and Kubernetes
Ruby
1
star
36

pivotal_visual

Python
1
star
37

kclean

Shell
1
star
38

haml-hikidoc-filter

Ruby
1
star
39

its-iot-study

Document and SandBox codes for IoT study meet up
JavaScript
1
star
40

fmoce

TypeScript
1
star
41

Miffy

掃除当番通知アプリ
Java
1
star