3. Create a new query

Sync the result of a SQL or visual query to one or more destinations on a fixed interval

Query with SQL

Navigate to the Queries page and start by creating a new query.

To get started quickly, we'll start by simply using SQL for your query.


This will depend on the schema of your database or data warehouse, but this query will return us a list of all our users.

If you want to learn more about exploring your data warehouse with SQL and with our visual query builder, check out the Exploring your data section of our docs.

Adding destinations

In the next step, we can select which destinations we want to send the query results to.

We can always add multiple destinations, but let's take Hubspot as an example. To set up the connection, we have to map the fields in the query results (from the database / data warehouse) to the fields in Hubspot.

Not all fields have to be mapped! If you leave certain mappings empty, the fields simply wont be synced to the object created in Hubspot.

This configuration is specific to each destination that the query results are being sent to. This particular configuration will upsert the Hubspot object contacts for each row in the query of users, and map first_name, last_name, and email to firstname, lastname, and email respectively.

For more information on the configuration of each destination, check out the Destinations section of the documentation.

Configure your query and sync schedule

Lastly, we have to schedule how often the query is run and subsequently synced to your destinations.

Make sure to also pick a unique primary key for your query. The unique primary key column is used by Hightouch to differentiate between new rows and changed rows when diffing results between consecutive runs before sending changes to downstream destinations like Hubspot.

Your segment can be synced at per minute, hourly, daily, and weekly intervals.