PostgreSQL sink options

This page contains a reference of all available options for the PostgreSQL sink.

General

  • connectionString: string: URL used to connect to your PostgreSQL database. Since the connection string usually contains the username/password you shouldn't set this option from the script, but use the POSTGRES_CONNECTION_STRING environment variable.
  • tableName: string: table where data will be inserted. The table must exist and it must have a schema compatible with the data returned by the transform step.
  • invalidate: { column: string, value: string }[]: additional conditions used when invalidating data. You should use this option when running multiple indexers writing data to the same table.
  • entityMode: boolean: enable entity mode. Refer to this page to learn more about entity mode.

TLS

  • noTls: boolean: disable TLS when connecting to the server.
  • tlsCertificate: string: path to the PEM-formatted X509 TLS certificate.
  • tlsDisableSystemRoots: boolean: disable system root certificates.
  • tlsAcceptInvalidCertificates: boolean: accept invalid TLS certificates.
  • tlsAcceptInvalidHostnames: boolean: disable hostname validation.
  • tlsUseSni: boolean: use Server Name Identification (SNI).

Connection string

Apibara supports specifying the PostgreSQL connection string using any format supported by libpq.

Connection URIs

This is the most common connection string format.

postgresql://[userspec@][hostspec][/dbname][?paramspec]

where userspec is:

user[:password]

and hostspec is:

[host][:port][,...]

and paramspec is:

name=value[&...]

Examples:

postgres://postgres:postgres@localhost:5432/postgres
postgres://aws-0-us-east-1.my-website:5432/myapp"

Keyword/Value connection strings

This format is less common but it's also supported. Each parameter is in the format key=value with spaces between strings. You can use single quotes (') to delimit a string that contains spaces.

Example:

host=localhost port=5432 dbname=postgres user=postgres password=postgres
Last modified
Apibara

Apibara is the fastest platform to build production-grade indexers that connect onchain data to web2 services.

© 2024 GNC Labs Limited. All rights reserved.