ETLMCPData Conveyance Works
Log in Start free
Docs

Rules that remove the date column: what PostgreSQL, CSV and webhooks receive

What each destination gets when a Select, Group by or Rename drops date: PostgreSQL and CSV get all-time totals, a webhook gets totals for the run's days only.

When your rules drop the date column, each destination reacts differently. PostgreSQL gets totals over the source's whole stored history, and every run replaces all of the pipeline's earlier rows in the table, daily rows included. A CSV export gets totals over the whole stored history. A webhook gets totals for only the days the run covered, and nothing in the body says which days those are. If you want daily rows, keep date in your Select and your Group by.

Which rules remove the date

A row loses its date when one of these rules runs:

  • a Select whose field list leaves out date;
  • a Group by that does not list date among the columns it groups by, such as Group by campaign_name to get campaign totals;
  • a Rename that gives date another name, such as date -> day.

A later Set or Derive that writes a column called date puts one back. Otherwise, every row the destination receives has no date.

PostgreSQL: all of history, and every row replaced

Normally a PostgreSQL run replaces only its own date range in your table. That depends on the rows carrying a date. When the run's rows have none, etlmcp reads the source's whole stored history, applies your rules to all of it, and delivers the result. In the table, it then deletes every row this pipeline wrote, whatever its date, and inserts the new rows.

So if your pipeline delivered daily rows for months and you then add Group by campaign_name, the next run deletes those daily rows and leaves one total per campaign, summed over everything stored. Rows other pipelines wrote to the same table stay.

Two more effects follow from the table's columns:

  • A table that was first created without a date column will not take one later. If you add date back to your rules, the run fails with table {…}.{…} is missing columns: {…}{…}, naming your schema and table and date. Deliver to a new table, or add the column yourself.
  • etlmcp creates a column as the PostgreSQL date type only when it is named date. If you renamed it, for example to day, the new column is created as text.

See how PostgreSQL rows are replaced for the dated case.

CSV export: totals over everything stored

A CSV export always receives the whole stored history of the source, dated or not. With date removed, a Group by gives totals over every stored day.

Webhook: totals for the run's days, unlabeled

A webhook receives only the rows in the run's date range: the trailing window on a routine sync, or the range you chose for a backfill. With date removed, each total covers just those days. The body carries rows, batch and batches and nothing about the range, so the receiver cannot tell which days a total is for. See the webhook payload and the trailing window.

How far back "everything stored" goes

Stored history is trimmed to your plan's history window, so "all-time" means at most that many days:

Plan Days of history kept
Free 30
Starter 365
Team 365
Agency 730
Scale 3650

Billing is coming: every account starts on Free. See the plans.

Large sources may wait

A run that delivers a source's whole history holds it all in memory. When the source has a large number of stored rows, these runs share a memory budget with other large deliveries, and a run that does not fit is put off with waiting for other large syncs to end. This applies to CSV exports and to PostgreSQL runs whose rules drop the date. See large history deferral.

Keeping daily rows

To keep one row per day, list date wherever you narrow the columns. The rule editor's own examples do this: its Select example is date, campaign_name, cost, and its Group by example is date, campaign_name. If you want campaign totals over a period, keep the daily rows in the destination and sum them in your query, where you choose the dates. See Group by.

Related