Send Data to SQL

close

To send data to the SQL server, you must use the 'Send to SQL' building block. Let's say, you have a table named table1 in a Postgres database. This table has two columns: col1 and col2.

We aim to populate this table with values from Facebook's Ad Name and Clicks columns.

We'll create a workflow using three building blocks:

  1. Download data from Facebook

  2. Select the desired columns

  3. Send data to SQL

Let's examine how to configure the "Send dataset to SQL" block in detail.

You need to write an SQL expression, which Conduit executes for each row in the dataset. Macros (e.g., {Ad} and {Clicks} as shown in the screenshot) are placeholders that Conduit replaces with values from the corresponding columns of the dataset.

Additionally, there is a special macro, {RowUpdatedId}. This is generated as a hash of all dimensions, but not metrics. You can use this value to update rows in the table.