Skip to main content

PostgreSQL Destination

The platform supports connections tp PostgreSQL resources used as destinations.

Turbine Code Examples

Once you have configured a PostgreSQL resource, you can use it as a destination in your streaming application by using the resources and write methods in your Turbine code.

In this example, the PostgreSQL Resource is named named pg_db. We want to write data to the users table. If you have a schema other than public, you'll need to indicate that like so: schema_name.users.

 exports.App = class App {
   async run(turbine) {
    let destination = await turbine.resources("pg_db");
     await destination.write("users");
   }
 };

To learn more about how to use these Turbine methods to stream data from a Turbine streaming application to your PostgreSQL destination using JavaScript, check out the Turbine App Overview for JavaScript.