presto-client
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -21,2 +21,24 @@ var Headers = exports.Headers = function(){ | ||
Headers.AUTHORIZATION = 'Authorization'; | ||
Headers.AUTHORIZATION = 'Authorization'; | ||
var TrinoHeaders = exports.TrinoHeaders = function(){ | ||
}; | ||
TrinoHeaders.USER = 'X-Trino-User'; | ||
TrinoHeaders.SOURCE = 'X-Trino-Source'; | ||
TrinoHeaders.CATALOG = 'X-Trino-Catalog'; | ||
TrinoHeaders.SCHEMA = 'X-Trino-Schema'; | ||
TrinoHeaders.TIME_ZONE = 'X-Trino-Time-Zone'; | ||
TrinoHeaders.CURRENT_STATE = 'X-Trino-Current-State'; | ||
TrinoHeaders.MAX_WAIT = 'X-Trino-Max-Wait'; | ||
TrinoHeaders.MAX_SIZE = 'X-Trino-Max-Size'; | ||
TrinoHeaders.PAGE_SEQUENCE_ID = 'X-Trino-Page-Sequence-Id'; | ||
TrinoHeaders.SESSION = 'X-Trino-Session'; | ||
TrinoHeaders.USER_AGENT = 'User-Agent'; | ||
TrinoHeaders.AUTHORIZATION = 'Authorization'; |
@@ -14,3 +14,4 @@ const { URL } = require('url') ; | ||
var Headers = require('./headers').Headers; | ||
var PrestoHeaders = require('./headers').Headers; | ||
var TrinoHeaders = require('./headers').TrinoHeaders; | ||
@@ -24,2 +25,13 @@ var QUERY_STATE_CHECK_INTERVAL = 800; // 800ms | ||
args = {}; | ||
switch (args.engine) { | ||
case 'trino': | ||
this.headers = TrinoHeaders; | ||
break; | ||
case 'presto': | ||
default: | ||
this.headers = PrestoHeaders; | ||
break; | ||
} | ||
// exports.version set in index.js of project root | ||
@@ -75,8 +87,8 @@ this.userAgent = 'presto-client-node ' + exports.version; | ||
if (client.user) | ||
opts.headers[Headers.USER] = client.user; | ||
opts.headers[client.headers.USER] = client.user; | ||
if (client.source) | ||
opts.headers[Headers.SOURCE] = client.source; | ||
opts.headers[client.headers.SOURCE] = client.source; | ||
opts.headers[Headers.USER_AGENT] = this.userAgent; | ||
opts.headers[client.headers.USER_AGENT] = this.userAgent; | ||
@@ -89,3 +101,3 @@ /** | ||
if (client.basic_auth) | ||
opts.headers[Headers.AUTHORIZATION] = 'Basic ' + new Buffer(client.basic_auth.user + ":" + client.basic_auth.password).toString("base64"); | ||
opts.headers[client.headers.AUTHORIZATION] = 'Basic ' + new Buffer(client.basic_auth.user + ":" + client.basic_auth.password).toString("base64"); | ||
@@ -183,12 +195,12 @@ if (opts.body) | ||
if (opts.catalog || this.catalog) { | ||
header[Headers.CATALOG] = opts.catalog || this.catalog; | ||
header[client.headers.CATALOG] = opts.catalog || this.catalog; | ||
} | ||
if (opts.schema || this.schema) { | ||
header[Headers.SCHEMA] = opts.schema || this.schema; | ||
header[client.headers.SCHEMA] = opts.schema || this.schema; | ||
} | ||
if (opts.session) | ||
header[Headers.SESSION] = opts.session; | ||
header[client.headers.SESSION] = opts.session; | ||
if (opts.timezone) | ||
header[Headers.TIME_ZONE] = opts.timezone; | ||
header[client.headers.TIME_ZONE] = opts.timezone; | ||
@@ -195,0 +207,0 @@ |
{ | ||
"name": "presto-client", | ||
"version": "0.9.0", | ||
"description": "Distributed query engine Presto client library for node.js", | ||
"version": "0.10.0", | ||
"description": "Distributed query engine Presto/Trino client library for node.js", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -24,3 +24,3 @@ # presto-client-node | ||
``` | ||
```shell | ||
npm install -g presto-client | ||
@@ -69,6 +69,9 @@ ``` | ||
* When set to `true`, this flag modifies the condition of the state change callback to return data every `checkInterval`(default: 800ms). Modify `checkInterval` if you wish to change the frequency. | ||
* Otherwise (`false`), the state change callback will only be called upon a change in state. | ||
* The purpose of this variable is to enable verbose update capability in state callbacks. This is such that "percentage complete" and "processed rows" may be extracted despite the state still remaining in a particular state eg. "RUNNING". | ||
* Otherwise (`false`), the state change callback will only be called upon a change in state. | ||
* The purpose of this variable is to enable verbose update capability in state callbacks. This is such that "percentage complete" and "processed rows" may be extracted despite the state still remaining in a particular state eg. "RUNNING". | ||
* jsonParser [object] | ||
* Custom json parser if required (default: `JSON`) | ||
* engine [string] | ||
* Change headers set. Added for compatibility with Trino. | ||
* Available options: presto, trino (default: presto) | ||
@@ -84,2 +87,3 @@ return value: client instance object | ||
Attributes of opts [object] are: | ||
* query [string] | ||
@@ -172,2 +176,4 @@ * catalog [string] | ||
* 0.10.0: | ||
* add "engine" option to execute queries on Trino | ||
* 0.9.0: | ||
@@ -174,0 +180,0 @@ * make "catalog" and "schema" options optional (need to specify those in queries if omitted) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24415
355
225