I need to query from a table in our dw on Amazon Redshift. I've been reading but can't find a way to query from a table in there, i usually do this to connect using sequelize.
const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');
const basename = path.basename(__filename);
const db = {};
const sequelize = new Sequelize(
process.env.DB_REDSHIFT,
process.env.DB_USER,
process.env.DB_PASS,
{
host: process.env.DB_HOST,
dialect: 'postgres',
...process.env.NODE_ENV !== 'dev' && {
logging: false,
},
define: {
underscored: true,
},
dialectOptions: {
multipleStatements: true,
dateStrings: true,
typeCast: (field, next) => {
if (field.type === 'DATETIME' || field.type === 'TIMESTAMP') {
return field.string();
}
return next();
},
},
pool: {
max: 1,
min: 0,
idle: 10000,
},
},
);
fs.readdirSync(__dirname).filter((file) => {
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
}).forEach((file) => {
const model = sequelize.import(path.join(__dirname, file));
db[model.name] = model;
});
Object.keys(db).forEach((modelName) => {
if (db[modelName].associate) {
db[modelName].associate(db);
}
});
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;
but i get SequelizeHostNotFoundError: getaddrinfo ENOTFOUND, i have tried using the endpoint, jdbc and odbc, i'm really new on this so anything would be helpfull.