RudderStack's Models feature lets you define and run custom SQL queries on your warehouse data and send the results to your specified destinations. You can create a model in the RudderStack dashboard and use it while connecting a Reverse ETL source to a destination.
RudderStack provides the following options to map your warehouse columns to specific destination fields while importing the data:
- Map with Visualizer (Refer to the Visual Data Mapper guide for the list of the supported destinations.)
- Map with JSON
This guide lists the JSON mapping settings required to import and sync data from your model to the specified destination.
The settings to import and sync data from your model are listed below:
- Model: Select the required model from the dropdown.
- Sync mode: Select the sync mode that RudderStack should use to sync your data. For more information on these modes, refer to the Sync Modes guide.
- Primary Key: Select a column from the data returned by the model (specified above) to uniquely identify your records in the warehouse.
Event Type: Select from the
trackevent type depending on how you want to send the event data to the downstream destinations. If you select
track, you also need to provide:
Event Name: Enter the event name which should be sent for all the events to the downstream destinations, as shown:
You can also send different event names by enabling the lookup event name by column setting and specifying the column name which should be used to set the event name in the Event Name field, as shown:
- Choose user identifier: Choose atleast one user identifier from
anonymous_idfrom the dropdown.
You can also preview the data snippet which RudderStack will send to the destination. All the resulting columns from running the model's query are selected by default. However, you can choose to retain specific columns by searching and selecting/deselecting them. Finally, preview the resulting JSON on the right, as shown:
anonymous_idfrom the columns selected in the Choose user identifier section. Moreover, the traits are used from the columns selected in the Column section.
You can also use the Add Constant option to add a constant key-value pair which is always sent in the JSON payload, as shown:
The new constant will appear in the table and also in the JSON preview inside the traits, as shown:
You can also use the dot notation to define a constant, as shown:
Once you have finalized the configuration, click Save.
To update an existing configuration, follow these steps:
- Go to the Schema tab of your configured source.
- Click the Update button, as shown:
- Update your column selection.
- Finally, click the Save button.