Alooma automatically creates one or more event types for each input, depending on the type of input. We'll automatically add a field under the
_metadata dictionary called
event_type to each every event:
Some inputs generate a single event type because they only stream one type of data into Alooma. An example of that is Google Analytics or Facebook Ads Insights, which generate an event type for the report they generate.
Others generate multiple event types, each one representing a sub-portion of that input. For example, MySQL will generate an event type for every table being streamed, Salesforce for every object, or Mixpanel for every type of click event.
Create a new event type
Why create a new event type?
You can create new event types when you want to split up and replicate data from a particular event type into more than one table in the target data warehouse.
You can also create a new event type when you want to map two different inputs into the same table in your target data warehouse. In this case, you might use the target table name as the event type name and use the Code Engine to merge the fields from both sources.
You can change the value of the event type field in the Code Engine to create additional event types. All events with the previous event type will continue to stream to it, and all events with the new event type will stream to the new one.
As an example, the following describes how to create an event type for each value of a field named Type. The values of the Type field (such as Type A, Type B, Type C and so on) will then appear in the Mapper screen’s event type list.
In the transform function, add a Python command that changes the value of the
event_typefield of the
For example, the following shows how to change
event['_metadata']['event_type']to the value of the
typefield of the event. Alooma then creates multiple new event types (one for each value of the type field). You can then map each event type to the table of your choice in the target data warehouse.
event['_metadata']['event_type'] = event['type']
Select a sample event from the Sample area of the Code Engine, then click Run Test to display the results of this change on the displayed sample event.
Click Deploy to publish these changes. All subsequent events will be transformed by the Code Engine using this code. Note that the Code Engine only runs on newly arriving events, and does not affect data already replicated into your target data warehouse.