-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (32 loc) · 901 Bytes
/
index.js
File metadata and controls
37 lines (32 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var redshiftEncodeTable = require('./redshift-table-encode');
var options = {
'schema': 'tableschema',
'table': 'tablename',
'connectionString': 'connection string as used in pg',
'password': 'password'
};
/**
* example 1:
* encode whole table using a temp table.
* useful for first time encoding (most of the columns are not encoded)
*/
redshiftEncodeTable.tabularEncode(options, function(err, data){
if (err) {
console.log(err);
} else {
console.log(data);
}
});
/**
* example 2:
* encode only the columns in the table that are not encoded.
* useful for encoding new columns that were added to an existing table.
* a good practice is to run a vacuum on the table after the process.
*/
redshiftEncodeTable.columnarEncode(options, function(err, data){
if (err) {
console.log(err);
} else {
console.log(data);
}
});