auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
// We want to extract browser, OS data from the User-Agent header, so we use the user-agent module.
// Just require() npm modules that you want to use here, no need to npm install
const useragent = require("useragent")
// Our payload starts as a copy of event.body, the HTTP payload in the request
this.payload = event.body
if (event.headers && 'user-agent' in event.headers) {
this.payload.ua = useragent.parse(event.headers['user-agent'])
}
// Then, we decorate our incoming HTTP request with the Pipedream event ID
// and the timestamp we processed it at, both accessible in the global variable $context
this.payload.ts = steps.trigger.context.ts
this.payload.pd_event_id = steps.trigger.context.id
// There's a lot more you can do with Node.js code cells. Check out the docs for more info!
// https://docs.pipedream.com/workflows/steps/code/
A JavaScript object representing the payload to send to Snowflake
async
(params, auths) => {
}
const {
user,
private_key,
database,
schema,
stage_name,
pipe_name,
account,
host,
} = auths.snowflake
// See https://docs.pipedream.com/destinations/snowflake/
$send.snowflake({
user,
private_key,
database,
schema,
stage_name,
pipe_name,
account,
host: `${account}.snowflakecomputing.com`,
payload: params.payload
})