PostgreSQL
PostgreSQL is a powerful, open-source object-relational database system. It can be used as an upstream or downstream resource in your Turbine data applications using the records
or write
functions to a select table in a databse.
Meroxa supports self-hosted and Amazon RDS instances of PostgreSQL versions 9.6.x
, 10.x
, 11.x
, 12.x
, or later.
Setup
Networking
To add a PostgreSQL database as a resource, it must be accessible by Meroxa. If not publicly accessible, here are some ways to give Meroxa access.
Resource Configuration
Use the meroxa resource create
command to configure your PostgreSQL resource.
The following example depicts how this command is used to create a PostgreSQL resource named pg_db
with the minimum configuration required.
$ meroxa resource create pg_db \
--type postgres \
--url postgres://$PG_USER:$PG_PASS@$PG_URL:$PG_PORT/$PG_DB
For resources that have Logical Replication enabled, you can configure this for your resource by including --metadata '{"logical_replication":"true"}'
or toggling it on in the Meroxa Dashboard.
In the command above, replace the following variables with valid credentials from your PostgreSQL environment:
$PG_USER
- PostgreSQL Username$PG_PASS
- PostgreSQL Password$PG_URL
- PostgreSQL URL$PG_DB
- PostgreSQL Database Name$PG_PORT
- PostgreSQL Port (e.g., 5432).
Connections
Logical Replication
Logical Replication is used to consume the changes from PostgreSQL's transaction log and produces a data record for every INSERT
, UPDATE
, and DELETE
operation.
Read more on how to set up Logical Replication for your PostgreSQL resource.
Polling
Polling is used to periodically query its data source, capture the result as a data record and pushed into a stream.
Read more on the supported polling query modes for your PostgreSQL resource.
Data Record Output
See an example data record for a PostgreSQL resource using Logical Replication or Polling connection types.