Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
import type { WarehouseDestinationDefinition } from '@segment/actions-core'
import { Settings } from '../snowflake/generated-types'
import { defaultValues } from '@segment/actions-core'
import { Settings } from './generated-types'
import sendCustomEvent from './sendCustomEvent'
import journeysDefaultFields from './sendCustomEvent/journeys-default-fields'
import audienceDefaultFields from './sendCustomEvent/audience-default-fields'

const destination: WarehouseDestinationDefinition<Settings> = {
name: 'Databricks',
slug: 'databricks',
mode: 'warehouse',

settings: {},
settings: {
warehouseId: {
label: 'Warehouse ID',
description: 'The ID of the existing Databricks warehouse instance to use.',
type: 'string',
required: true
}
},

actions: {}
presets: [
{
name: 'Linked Audience Entity Added',
partnerAction: 'sendCustomEvent',
mapping: {
...defaultValues(sendCustomEvent.fields),
...defaultValues(audienceDefaultFields)
},
type: 'specificEvent',
eventSlug: 'warehouse_entity_added_track'
},
{
name: 'Linked Audience Associated Entity Removed',
partnerAction: 'sendCustomEvent',
mapping: {
...defaultValues(sendCustomEvent.fields),
...defaultValues(audienceDefaultFields)
},
type: 'specificEvent',
eventSlug: 'warehouse_entity_removed_track'
},
{
name: 'Linked Audience Profile Entered',
partnerAction: 'sendCustomEvent',
mapping: {
...defaultValues(sendCustomEvent.fields),
...defaultValues(audienceDefaultFields)
},
type: 'specificEvent',
eventSlug: 'warehouse_audience_entered_track'
},
{
name: 'Linked Audience Profile Exited',
partnerAction: 'sendCustomEvent',
mapping: {
...defaultValues(sendCustomEvent.fields),
...defaultValues(audienceDefaultFields)
},
type: 'specificEvent',
eventSlug: 'warehouse_audience_exited_track'
},
{
name: 'Journeys Step Entered',
partnerAction: 'sendCustomEvent',
mapping: {
...defaultValues(sendCustomEvent.fields),
...defaultValues(journeysDefaultFields)
},
type: 'specificEvent',
eventSlug: 'journeys_step_entered_track'
}
],

actions: {
sendCustomEvent
}
}

export default destination
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default {
// note that this must be `properties` to be processed by the warehouse pipeline
properties: {
label: 'Columns',
description: `Additional columns to write to Databricks.`,
type: 'object',
defaultObjectUI: 'keyvalue',
required: true,
additionalProperties: true,
default: {
entity_context: {
'@json': {
mode: 'encode',
value: {
'@path': '$.properties.data_graph_entity_context'
}
}
},
user_id: { '@path': '$.userId' },
audience_key: { '@path': '$.properties.audience_key' },
personas_computation_key: { '@path': '$.context.personas.computation_key' },
personas_computation_id: { '@path': '$.context.personas.computation_id' },
personas_computation_run_id: { '@path': '$.context.personas.computation_run_id' },
personas_activation_id: { '@path': '$.context.personas.event_emitter_id' },
event_name: { '@path': '$.event' }
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'

const action: ActionDefinition<Settings, Payload> = {
title: 'Send Custom Event',
description: 'Record custom events in Databricks',
fields: {
event: {
label: 'Table Name',
description: 'The name of the table.',
type: 'string',
required: true,
default: { '@path': '$.event' },
unsafe_hidden: true
},
// note that this must be `properties` to be processed by the warehouse pipeline
properties: {
label: 'Columns',
description: `Additional columns to write to Databricks.`,
type: 'object',
defaultObjectUI: 'keyvalue',
required: true,
additionalProperties: true,
default: {
user_id: { '@path': '$.userId' }
}
},
// These are all required for data to be processed by the warehouse pipeline
messageId: {
label: 'ID',
description: 'Name of column for the unique identifier for the message.',
type: 'string',
required: true,
default: { '@path': '$.messageId' },
readOnly: true
},
type: {
label: 'Event Type',
description: 'The type of event.',
type: 'string',
required: true,
default: { '@path': '$.type' },
readOnly: true,
// this is required for the warehouse pipeline to process the event,
// but it's removed before being sent to Databricks
unsafe_hidden: true
},
receivedAt: {
label: 'Received At',
description: 'Time when event was received.',
type: 'datetime',
required: true,
default: { '@path': '$.receivedAt' }
}
},
perform: () => {
return undefined
}
}

export default action
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export default {
// note that this must be `properties` to be processed by the warehouse pipeline
properties: {
label: 'Columns',
description: `Additional columns to write to Databricks.`,
type: 'object',
defaultObjectUI: 'keyvalue',
required: true,
additionalProperties: true,
default: {
journey_metadata: {
'@json': {
mode: 'encode',
value: {
'@path': '$.properties.journey_metadata'
}
}
},
journey_context: {
'@json': {
mode: 'encode',
value: {
'@path': '$.properties.journey_context'
}
}
},
user_id: { '@path': '$.userId' },
personas_computation_key: { '@path': '$.context.personas.computation_key' },
personas_computation_id: { '@path': '$.context.personas.computation_id' },
personas_activation_id: { '@path': '$.context.personas.event_emitter_id' },
personas_computation_class: { '@path': '$.context.personas.computation_class' },
event_name: { '@path': '$.event' }
}
}
}
Loading