ETLMCPData Conveyance Works
Log in Start free
Guides

Connect Looker Studio to the etlmcp PostgreSQL table

Data Studio (Looker Studio) reads your etlmcp table once Google's IP ranges are allowed; use a custom query outside public and stay under 150,000 rows.

Google's PostgreSQL connector for Data Studio (formerly Looker Studio) can read the table etlmcp loads, with four conditions. Your server must accept connections from Google's address range. A table outside the public schema has to be read through a custom query. No single query may need more than 150,000 rows, because the connector cuts off the rest. And the dotted names of extra columns need double quotes in your SQL.

Open your firewall to Google

The connector reaches your database from Google's servers, not from your browser. Allow 142.251.74.0/23 for IPv4 and, if your server listens on IPv6, 2001:4860:4807::/48. If your organization has a Data Studio Pro subscription with data residency turned on, the connector uses 142.251.56.0/24 (IPv6 2001:4860:4815::/48) instead.

On Cloud SQL with a public IP, add these ranges to the instance's authorized networks: the connector does not go through the Cloud SQL Auth Proxy, so a proxy setup alone will not let it in. A Cloud SQL instance on a private IP takes a different route, through the jdbc:google:postgresql:// URL form, the Cloud SQL Client IAM role and the instance's private path setting; Google's page lists the steps.

etlmcp itself only connects to a host on the public internet, so the server you gave the PostgreSQL destination is already one Google can reach once the firewall allows it.

Connect with SSL and a separate login

Choose the basic form (host, port, database, user, password) or a JDBC URL. To encrypt the link, turn SSL on and upload your server's certificate files. For client certificate authentication you also upload a client certificate and its private key, and the key must be in PKCS-8 format; a key in another format has to be converted first.

Give the dashboard its own login rather than the one etlmcp writes with. In PostgreSQL a role needs USAGE on the schema to look up the table in it, plus SELECT on the table. GRANT SELECT ON ALL TABLES IN SCHEMA covers only the tables that exist when you run it. The steps are in a read-only role for BI tools.

Pick the table, or write a custom query

The destination's schema is a setting with the default public. If you left it there, your table shows up in the connector's table list. The list shows tables in public only, so if you set another schema, choose the custom query option and select from the table by its full name.

A custom query must be one statement, because the connector wraps it as an inner SELECT inside each query it sends. Scripts with variables or several statements fail. A query that takes longer than roughly three to five minutes may time out; Google's advice is to simplify it or to materialize the result in a table and connect that.

What the columns look like

etlmcp creates the table on its first load with fixed types:

Column PostgreSQL type
date date
impressions, clicks, cost, conversions, conversion_value, ctr, cpc, cpm, cpa double precision
a platform's catalogued extras, such as extra.sessions double precision
network, account_id, account_name, the campaign, ad group and ad IDs and names, currency text
_etlmcp_pipeline_id text

Numeric, text and date types are all in the connector's supported list, so every column becomes a field and none is dropped for its type. The _etlmcp_pipeline_id column marks which pipeline wrote each row; hide it in the report or filter on it when one table holds several pipelines.

Google also requires field names in plain ASCII. etlmcp's standard column names are lowercase ASCII with underscores.

Extra columns keep their dots

A platform's extra metrics land in columns named extra. plus the field's key. With a GA4 source, when that connector is available on your account, sessions arrive as extra.sessions. A plain identifier cannot contain a dot, while a name in double quotes may hold any character, so put the name in double quotes in any custom query, and give it a plain alias so the Data Studio field has a readable name. PostgreSQL keeps at most 63 bytes of a name by default; an extra name longer than that is shortened by etlmcp and ends in an underscore and a short hash, so copy the exact name from your table rather than typing it.

Stay under the row cap

Each query the connector runs returns at most 150,000 rows, and anything past that is cut off. Daily ad-level rows across several accounts can exceed this over a long date range, and the chart then works from incomplete rows.

Aggregate to the level your report needs before Data Studio sees the data. Recompute rates such as CTR and CPC as calculated fields from summed clicks, impressions and cost, because adding up the stored ratios gives wrong numbers.

SELECT
  date,
  network,
  account_name,
  campaign_name,
  currency,
  SUM(impressions)      AS impressions,
  SUM(clicks)           AS clicks,
  SUM(cost)             AS cost,
  SUM(conversions)      AS conversions,
  SUM(conversion_value) AS conversion_value,
  SUM("extra.sessions") AS sessions
FROM marketing.ad_performance
GROUP BY date, network, account_name, campaign_name, currency

Paste a query like this into the custom query box, with your own schema and table names and only the extra columns your table has. If it runs slowly, save it as a view or a summary table in your database and read that instead.

Each etlmcp run replaces its date range for its own pipeline in a single transaction, so a refresh after a run shows the new figures for those days. The details are in how etlmcp replaces rows.

Related

Sources

  1. Connect to PostgreSQL — docs.cloud.google.com, checked
  2. Privileges — www.postgresql.org, checked
  3. GRANT — www.postgresql.org, checked
  4. Lexical Structure — www.postgresql.org, checked