I am trying to use the following package to connect to a presto db in Node.
This is what I have so far.
const presto = require('presto-client')
const client = new presto.Client({
host: 'xxx-presto-da.xxx.com',
port: 1234,
catalog: 'gridhive',
schema: 'rpt',
source: 'nodejs-client',
basic_auth: {user: 'xxx', password: 'xxx'},
})
const getPrestoData = () => {
client.execute({
query: `
select some query
`,
data: function (error, data, columns, stats) {
console.log('data:', data)
return data
},
success: function (error, stats) {},
})
}
console.log(getPrestoData())
But this is what's returned
13:56:15 in sellersjson-analysis/src/lib via ⬢ v18.3.0
> node presto.js
undefined
I am not sure what is being undefined. I just want to know the best way to implement this. Am I doing it correctly?