Search documentation...

K

With the SQL editor modeling method, you can write a SQL query to define your model. The SQL editor can execute whatever SQL is native to your warehouse or database.

Your query depends on the data in your model. For example, if you are using the Sample B2B SaaS Source, you can use the following query to select the entire public.users table:

SELECT * FROM public.users

Before you can continue, you must click Preview to see a preview of the data. By default, Hightouch limits the preview to the first 100 rows. Once you've confirmed that the preview contains the data you expect, click Continue.

Model preview using the SQL editor

You can't save a model if your query doesn't return any results. If you need to save a model with such a query because you expect there to be results in the future, add the following SQL to the end of your query:

UNION ALL
select 'ignore', 'ignore', 'ignore'

This SQL adds a row of 'ignore' values that don't match against anything in your destination but are always present so you can save the query. If your column datatype isn't a string, you can replace 'ignore' with a null value. The number of 'ignore' or null values needs to be the same as the number of columns in your model.

The last step for model setup is to enter a descriptive Name and select the column to use as a Primary key. You can optionally select a folder to move the model to.

Setting a model Name and Primary key in the Hightouch UI

Click Finish to complete your model setup.

Ready to get started?

Jump right in or a book a demo. Your first destination is always free.

Book a demoSign upBook a demo

Need help?

Our team is relentlessly focused on your success. Don't hesitate to reach out!

Feature requests?

We'd love to hear your suggestions for integrations and other features.

Was this page helpful?