-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (24 loc) · 749 Bytes
/
Copy pathindex.js
File metadata and controls
40 lines (24 loc) · 749 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
38
39
require('dotenv').config();
const snowflake = require('snowflake-sdk');
const connection = snowflake.createConnection({
account: process.env.SNOWFLAKE_ACCOUNT,
username: process.env.SNOWFLAKE_USERNAME,
password: process.env.SNOWFLAKE_PASSWORD,
database: process.env.SNOWFLAKE_DATABASE,
schema: process.env.SNOWFLAKE_SCHEMA
});
connection.connect((err, conn) => {
if (err) {
console.error('Unable to connect: ' + err.message);
} else {
console.log('Successfully connected to Snowflake.');
}
});
connection.execute({
sqlText: `PUT file://test.json @${process.env.SNOWFLAKE_SCHEMA}.ph_stage`,
binds: [],
complete: (err, stmt, rows) => {
console.log('err', err);
console.log('rows', rows);
},
});