项目作者: tmasjc

项目描述 :
A web interface for SQL query parameterization.
高级语言: R
项目地址: git://github.com/tmasjc/rubick.git
创建时间: 2020-09-18T10:39:14Z
项目社区:https://github.com/tmasjc/rubick

开源协议:

下载


Rubick

Background

A web interface that enables analyst to parameterize database query into web form. The main purpose is to allow end user access to database query without giving out database credential. Also prevents database injection.

Requirements

For Rubick to work, it requires 2 YAML files.

  • database.yml tells Rubick about your database connections

  • config.yml declares your SQL queries

Setup Database Connections

Assume that we have a MySQL database called ‘mart‘ and Hive data warehouse called ‘dbw‘, this is how we setup the connections.

Note that Rubick by default supports MySQL, thus we do not need to specify MySQL driver.

  1. default:
  2. master: NULL # not use
  3. mart:
  4. type: mysql
  5. host: your-database
  6. port: some-port
  7. username: some-user
  8. password: some-password
  9. dbname: some-database
  10. dbw:
  11. type: hive
  12. driver: /opt/mapr/hiveodbc/lib/universal/libmaprhiveodbc.dylib
  13. host: your-data-warehouse
  14. port: some-port
  15. username: some-user
  16. password: some-password

Declare SQL Queries

For every query we declare, it needs to have 3 things: a name (the root node), a file, and an origin.

Name must be unique so that we can identify them in web form selections. file links to the actual SQL query which we will execute. origin refers to some specific database connection which we declare in database.yml.

All SQL scripts must be put in a common folder. Specified under source key.

  1. default:
  2. title: "Rubick"
  3. subtitle: "拉比克"
  4. source: Scripts # where folder SQL scripts will be stored
  5. queryA:
  6. file: a.sql
  7. origin: mart
  8. token: # secret (optional)
  9. description: "example" # also optional
  10. queryB:
  11. file: b.sql
  12. origin: dbw
  13. token: 12345678
  14. description: "another example"