ETLMCPData Conveyance Works
Log in Start free
Guides

Connect etlmcp to Neon: use the direct connection string, not the pooled one

Which Neon connection string to give etlmcp, why the -pooler host in transaction mode is a poor fit, and what to allow when IP Allow is on.

To load data from etlmcp into Neon, give etlmcp the direct connection string: the host whose endpoint ID has no -pooler suffix. The pooled string that Neon's Console offers sends you through PgBouncer in transaction mode, which does not suit the way etlmcp opens its connection or the single long transaction it uses for each load. On the Destinations page, add a PostgreSQL destination with the direct host in Host, your role in User, its password, the database name in Database and a Table, then press Test.

How to tell the two strings apart

Neon builds the pooled host name by adding -pooler to the endpoint ID. A direct host such as ep-cool-darkness-123456.<region>... becomes ep-cool-darkness-123456-pooler.<region>... when pooled. Everything else stays the same, and the Connection pooling toggle in the Console's connect dialog switches between the two. Before you paste a host into etlmcp, look for -pooler in it and turn off the toggle or delete the suffix if it is there.

Behind the pooled host, Neon runs PgBouncer with its pool mode set to transaction. A server connection goes back to the pool as soon as a transaction ends, so the next transaction from the same client may land on a different server session.

Why etlmcp needs the direct string

  • A startup option. etlmcp opens every Postgres connection with statement_timeout passed as a connection startup option, along with application_name. PgBouncer's configuration reference says that, by default, it only accepts startup parameters it can track and raises an error for the rest. statement_timeout is not on its default tracked list, which holds parameters such as application_name, client_encoding, DateStyle and TimeZone. Neon's pooling page also lists statement_timeout among the settings that can carry over to other clients sharing a pooled connection.
  • One transaction per load. Each load runs inside a single transaction: etlmcp reads the table's columns, adds any it needs, deletes this pipeline's rows for the date range it is replacing, inserts the new rows, and commits once at the end. A large backfill keeps that transaction open for as long as the insert takes.

Neon itself recommends a direct connection for session-dependent work, such as SET and other session state, schema changes and long analytics queries. Its pooling page also says a query waits at most 120 seconds for a free pooled connection. A loader that adds columns and writes in bulk is that kind of work.

SSL

etlmcp connects with sslmode=require unless the operator of your etlmcp server changed that setting, so the connection is encrypted without any extra step on your side. For what each mode checks, see Postgres SSL.

IP Allow

IP Allow is Neon's IP allowlist. Neon offers it on the Scale plan, and you set it in the project's settings under Networking. It accepts single addresses, ranges and CIDR blocks, and you can apply it to protected branches only, which leaves every other branch open.

If IP Allow covers the branch etlmcp writes to, add etlmcp's address. The Destinations page shows that address in a note telling you which address to allow through a firewall. If the note is missing, the operator of your etlmcp server has not set one, so ask them for it. A blocked address shows up as a failed Test, so press Test again after you save the allowlist.

Before your first sync

Create a role for etlmcp rather than reusing the owner role, and grant it rights to create tables in the target schema; Postgres privileges lists the grants. Then press Test: etlmcp inserts one sample row and rolls it back, which proves the host, the role and write access in one step.

Related

Sources

  1. Connection pooling — neon.com, checked
  2. PgBouncer config — www.pgbouncer.org, checked
  3. IP Allow — neon.com, checked