Skip to content

Commit

Permalink
feat: snowpipe streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr committed Sep 17, 2024
1 parent a05e339 commit 5b0fdbd
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/v0/destinations/snowpipe_streaming/transform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { processWarehouseMessage } = require('../../../warehouse');

const provider = 'snowflake';

function getDataTypeOverride(key, val, options, jsonKey = false) {
if (key === 'violationErrors' || jsonKey) {
return 'json';
}
return 'string';
}

function process(event) {
const whSchemaVersion = event.request.query.whSchemaVersion || 'v1';
const whIDResolve = event.request.query.whIDResolve === 'true' || false;
const whStoreEvent = event.destination.Config.storeFullEvent === true;
const destJsonPaths = event.destination?.Config?.jsonPaths || '';
return processWarehouseMessage(event.message, {
metadata: event.metadata,
whSchemaVersion,
whStoreEvent,
whIDResolve,
getDataTypeOverride,
provider,
sourceCategory: event.metadata ? event.metadata.sourceCategory : null,
destJsonPaths,
destConfig: event.destination?.Config,
});
}

module.exports = {
provider,
process,
getDataTypeOverride,
};

0 comments on commit 5b0fdbd

Please sign in to comment.