redshift-query
Library which allows you to query Redshift using parameterized SQL files and promises.
Install
npm install redshift-query --save
Initialization:
connection
is your Redshift connection info. queryPath
is where your SQL files are located at.
const RedshiftQuery = const redshift = connection: user: 'super_cool_dev_person' database: 'rad_database' password: 'horse_battery_staple' port: 5439 host: 'rad_redshift' queryPath: './sql'
API
redshift#queryByFile(queryFile, parametersObj)
Warning: Do not use raw user input as parameter input, it opens you up to SQL injection attacks.
redshift
redshift#queryByString(queryString)
Warning: Do not use raw user input as parameter input, it opens you up to SQL injection attacks.
redshift
SQL file example:
SELECT type, nameFROM unicornsWHERE type='${type}'
Yep, nothing fancy. No need to make it a template string, just put a bunch of text in there (preferably Redshift-compliant SQL)