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
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.
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.
Click Finish to complete your model setup.