streaming-profile-transformations

1.0.0 • Public • Published

streaming-profile-transformations

Features

getMainID (ID string)

This function will return an object containing (MAIN_ID, TYPE, VALID_AT) as a promise. Here "TYPE" is the id_type of "ID", for example, user_ID.

Example:

const mainIdObj = await getMainID(userID)

getFeature (ID string, optional: isMainID = false)

This function will return an object as a promise, which contains all the features of a user present in the Feature table.

If "ID" is MAIN_ID then this function will skip calling the getMainID function and will directly return features corresponding to that MAIN_ID.

Example:

const featuresObj = await getFeature(mainID, true)

const featuresObj = await getFeature(userID)

Steps to use this package in transformer

1. Set up a Redis

  1. Login to Redis lab.
  2. Create a New Database.

2. Set up a reverse ETL connection

You can check this tutorial to setup a rETL connection Video

  1. Login to RudderStack.

  2. Add the Snowflake ID Graph table as a new Source and set up Connection Settings.

    As the ID Graph table doesn't have any primary key we have to generate a dummy primary key

    use this model to generate a dummy primary key

    select distinct(concat(ID1, ID1_TYPE, VALID_AT)) as key, ID1, ID1_TYPE, MAIN_ID, VALID_AT
    from TABLE_NAME;
    
  3. Add Redis as a new Destination, use the Redis Cluster address

    (optional) Add this Transformation to Redis Destination

    export function transformEvent(event, metadata) {
        event.traits = {
            "TYPE": event.traits.ID1_TYPE,
            "MAIN_ID": event.traits.MAIN_ID,
            "VALID_AT": event.traits.VALID_AT,
        }
        return event
    }
    
  4. Create an rETL connection between the Snowflake ID Graph table and Redis.

  5. Add the Snowflake Feature table as a new Source and use MAIN_ID as the primary key.

  6. Create another rETL connection between the Snowflake Feature table and Redis.

3. Use getMainID() and getFeatures() in transformer.

Readme

Keywords

none

Package Sidebar

Install

npm i streaming-profile-transformations

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

7.97 kB

Total Files

10

Last publish

Collaborators

  • abhishekpandey
  • moumitamandal
  • rudderstack-admin