Run custom SQL queries on your warehouse and send resulting data to the specified destinations.
4 minute read
RudderStack’s Models feature lets you create models by defining custom SQL queries. You can then run these queries on your warehouse and send the resulting data to specific destinations. You can create as many models and reuse them with their corresponding Reverse ETL sources.
With this feature, you can:
Build models with complex SQL queries using an intuitive UI.
Manage views of all models synced to different destinations in one place.
Specify the warehouse credentials to authenticate RudderStack. See the Configure warehouse credentials section of the source-specific documentation (for example, Redshift) for more details.
Once you select or add your warehouse credentials and click Next, RudderStack will validate them before you can proceed with the setup. See FAQ for more information on these validations.
Specify model name
Assign a name to uniquely identify the source in the RudderStack dashboard.
Select the source type to Model and click Continue.
Configure model
Enter an optional model description.
Specify the custom SQL query in Query section.
Click Run Query to fetch the data preview.
Select the Primary key to use a column that uniquely identifies your warehouse records.
You can set a primary key only after you run the SQL query successfully using the Run Query option.
Note the following:
The Preview section displays the preview of the 50 resultant rows in a paginated format.
You can add single-line/multiline comments above the query. However, RudderStack supports only multiline comments at the end of the query. Support for single-line comments is coming soon.
You don’t need to add a semi-colon at the end of a query. RudderStack handles this automatically before running the query on the warehouse data.
Review and complete setup
To make any changes to the warehouse credentials or audience configuration, click the edit icon present next to those sections.
Once you have reviewed your configuration, click Create source to complete the setup.
Connect model to destination
You can connect this source to an existing or new destination to start using it. To connect to a destination later, click Done on the top right.
You will then be redirected to the Overview page of the source where you get the option of connecting it to an existing or new destination.
You cannot delete a source that is connected to any destination.
FAQ
What do the three validations under Verifying Credentials imply?
Once you proceed after entering the connection credentials, you will see the following validations under the Verifying Credentials option:
These options are explained below:
Verifying Connection: Indicates that RudderStack is trying to connect to the warehouse with the information specified in the connection credentials.
If this option gives an error, it means that one or more fields specified in the connection credentials are incorrect. Verify your credentials in this case.
Able to List Schema: Checks if RudderStack is able to fetch all schema details using the provided credentials.
Able to Access RudderStack Schema: Checks if RudderStack has the required access to the _RUDDERSTACK / _rudderstack schema (depending on your warehouse). To create the schema, run all commands listed in the Permissions section of the respective Reverse ETL source documentation:
If this option gives an error, verify if you have successfully created the _RUDDERSTACK / _rudderstack schema and given RudderStack the required permissions to access it.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.