Destinations
PostgreSQL
How to configure PostgreSQL as a destination in Mage to write pipeline data into a PostgreSQL table using direct database credentials and optional schema/table controls.
Overview
Use PostgreSQL as a destination in Mage to export structured data from your pipelines directly into a PostgreSQL table. Mage supports both self-hosted and cloud-hosted PostgreSQL instances such as bit.io, Supabase, Render, and AWS RDS.
Mage will automatically create the target table and insert pipeline output rows into it, with support for schema selection, lowercase column naming, and reserved keyword handling.
Configuration Parameters
Provide the following credentials when setting up PostgreSQL as a destination:
Key | Description | Example Value | Required |
---|---|---|---|
database | Name of the PostgreSQL database where data will be written. | demo | ✅ |
host | Hostname or IP address of the PostgreSQL server. | db.bit.io | ✅ |
port | Port used by the PostgreSQL service. Default is 5432 . | 5432 | ✅ |
username | Username with access to the target database and schema. | guest | ✅ |
password | Password for the PostgreSQL user. | abc123... | ✅ |
schema | Name of the schema where the table will be created. | public | ✅ |
table | Name of the table Mage will write records into. | dim_users_v1 | ✅ |
Optional Parameters
Key | Description | Example Value |
---|---|---|
skip_schema_creation | If true , Mage will skip running CREATE SCHEMA . Use this if the schema already exists. See issue | true |
lower_case | If true , Mage will convert all column names to lowercase. Default is true . | true |
allow_reserved_words | If true , Mage will allow column names that are PostgreSQL reserved words. Default is false . | true or false |
Notes
- PostgreSQL is a widely supported open-source relational database—ideal for analytics, app backends, and transformations.
- Ensure the user has
CREATE TABLE
,INSERT
, and optionallyCREATE SCHEMA
privileges. - Mage supports exporting data to existing tables or creating new tables based on the pipeline output schema.
- If your database is hosted on platforms like Heroku, AWS RDS, or bit.io, make sure the network settings allow inbound connections from Mage.