The _etlmcp_pipeline_id column tells you which pipeline wrote each row. Every table etlmcp creates in PostgreSQL gets it as a text NOT NULL column, and the BigQuery destination, when it is available, gives its tables the same column as a required field. Because a run deletes and rewrites only rows that carry its own pipeline's ID, you can point several pipelines at one table and none of them will erase another's rows. What the column does not do is stop you from adding up the same spend twice: if two pipelines pull the same ad account into one table, every query that sums cost must filter on one pipeline ID.
What the column holds
The value is the pipeline's ID: the letters pl_ followed by a long string of hexadecimal characters. etlmcp writes it on every row it inserts, so the column is never empty. When etlmcp creates the table, it places the column after the report columns such as date, network, account_id, campaign_id, cost and currency; platform extras that appear later are added after it.
You can find a pipeline's ID in three places:
- the address of the pipeline's page in the dashboard, which ends in the ID;
- the
idfield that List pipelines returns over the REST API, or list_pipelines over MCP; - the table itself, with a query that lists what is there.
SELECT _etlmcp_pipeline_id, network, account_id,
min(date) AS first_day, max(date) AS last_day, count(*) AS row_count
FROM public.ad_performance
GROUP BY 1, 2, 3
ORDER BY 1;
The name is reserved. If a pipeline's rules produce a column called _etlmcp_pipeline_id, the run stops instead of writing it.
Why sharing a table is safe
Each PostgreSQL run works out its date range, then deletes rows where _etlmcp_pipeline_id equals its own ID and date falls in that range, then inserts the new rows, all in one transaction. The WHERE clause of that delete always names the pipeline, so rows from other pipelines in the same table are never touched, whatever dates they cover. A run whose rows have no date column clears all of its own pipeline's rows and nothing else. The row replacement page walks through a run step by step.
The column is also how etlmcp recognises its own tables. A PostgreSQL table without it is refused rather than altered, so you cannot aim a pipeline at a table you built by hand. Pick a new table name and let the first run create it.
When spend is counted twice
Sharing is safe for writes, not for sums. Each source can feed several pipelines, and two pipelines on the same ad account both write full rows for the same days. A common case is one pipeline with no rules next to a second one that renames or groups campaigns. Both land in the table, both are correct on their own, and a plain SUM(cost) over the table reports double the real spend.
Check for overlap before you build a report:
SELECT network, account_id, date,
count(DISTINCT _etlmcp_pipeline_id) AS pipelines
FROM public.ad_performance
GROUP BY 1, 2, 3
HAVING count(DISTINCT _etlmcp_pipeline_id) > 1
ORDER BY date DESC;
Any row this returns is a day where more than one pipeline holds the same account. Choose one pipeline per account and filter on it:
SELECT date, sum(cost) AS spend, sum(clicks) AS clicks
FROM public.ad_performance
WHERE _etlmcp_pipeline_id = 'pl_0123456789abcdef0123456789abcdef'
GROUP BY date
ORDER BY date;
Different accounts in one table need no filter: pipelines for separate accounts never hold the same rows, so their totals add up correctly.
A view per pipeline
A PostgreSQL view stores the filter once. Postgres does not keep a copy of the rows for a plain view; it runs the view's query each time you read from it, so the view always shows what the latest run wrote.
CREATE VIEW reporting.meta_main AS
SELECT *
FROM public.ad_performance
WHERE _etlmcp_pipeline_id = 'pl_0123456789abcdef0123456789abcdef';
Point your BI tool at the view rather than the shared table, and analysts cannot double count by accident.
Rows of a deleted pipeline
Deleting a pipeline in etlmcp removes the pipeline and its stored CSV exports, but it does not connect to your database, so its rows stay in your table. No later run will ever replace them, since no pipeline carries that ID any more. Remove them yourself when you no longer want them:
DELETE FROM public.ad_performance
WHERE _etlmcp_pipeline_id = 'pl_0123456789abcdef0123456789abcdef';
BigQuery, when the destination is available
The BigQuery destination is coming. When it is available, it creates each table partitioned by day on date and clustered on _etlmcp_pipeline_id, and its run replaces rows in one transaction that, as in PostgreSQL, deletes only the pipeline's own rows in the range. It also refuses any existing table that lacks the column, and never alters one.
Clustering matters for cost. Google's documentation explains that BigQuery sorts a clustered table's storage blocks by the clustering column and skips blocks that cannot match a filter on it, so a query with WHERE _etlmcp_pipeline_id = … reads fewer bytes than one without.