PostgreSQL

The World's Most Advanced Open Source Relational Database

Go to site
Explore
/
Apps
/
PostgreSQL

PostgreSQL API Integrations

Build and run workflows using the PostgreSQL API. Use 1000s of open source triggers and actions across 800+ apps. Or write custom code to integrate any app or API in seconds.

module.exports = defineComponent({
  props: {
    postgresql: {
      type: "app",
      app: "postgresql",
    }
  },
  async run({steps, $}) {
    const { Client } = require('pg')
    
    const { host, user, password, port, database } = this.postgresql.$auth
    
    const client = new Client({
      host,
      database,
      user,
      password,
      port,
    })
    
    await client.connect()
    this.results = (await client.query("SELECT NOW()")).rows
    await client.end()
  },
})

Authentication

PostgreSQL uses API keys for authentication. When you connect your PostgreSQL account, Pipedream securely stores the keys so you can easily authenticate to PostgreSQL APIs in both code and no-code steps.

Before you connect to your PostgreSQL database from Pipedream, please make sure your database is either:

  1. Accessible from the public internet (You may need to add a firewall rule on 0.0.0.0/0 on port 3306), or

  2. Accessible from an SSH server that you route PostgreSQL requests through

After that, enter the following values:

  • host: The hostname or IP address of your PostgreSQL server
  • port: 3306, unless you run PostgreSQL on a different port
  • username: The account username to log in
  • password: The account password to log in
  • database: The name of the PostgreSQL database to run queries against