Skip to content

Instantly share code, notes, and snippets.

@joelgarciajr84
Created February 7, 2021 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelgarciajr84/026f42cdded95d497fc6295d5256546e to your computer and use it in GitHub Desktop.
Save joelgarciajr84/026f42cdded95d497fc6295d5256546e to your computer and use it in GitHub Desktop.
Implementing lib presto-ts
import { Presto, PrestoQueryParams, PrestoResponse } from "presto-ts";
const prestoStatusUpdate = (prestoNotification: PrestoResponse): PrestoResponse => {
console.log("NEW PRESTO QUERY STATUS")
console.log(prestoNotification)
return prestoNotification;
}
const errorPresto = (error: Error) => {
console.error(error)
return error
}
const requestParams: PrestoQueryParams = {
query: 'SELECT * FROM pedidos',
catalog: 'mysqldb',
schema: 'clientes',
source: 'test-presto',
user: 'root',
password:'xxx',
host: 'localhost',
port: 8080,
isBasicAuth:true,
checkStatusInterval: 1000,
updatesNotification: prestoStatusUpdate,
errorNotification: errorPresto
}
const goPresto = new Presto (requestParams).go()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment