PostgreSQL / PostGraphile

image

This handler allows you to use GraphQL schema created by PostGraphile, based on a PostgreSQL database schema.

To get started, install the handler library from NPM:

$ yarn add @graphql-mesh/postgraphile

Now, you can use it directly in your Mesh config file:

sources:
- name: MyDb
handler:
postgraphile:
connectionString: postgres://postgres:password@localhost/postgres

You can check out our example that uses schema stitching with a PostgreSQL datasource. Click here to open the example on GitHub

External Plugins (e.g. Federation)

You can add PostGraphile plugins such as FederationPlugin and ConnectionFilterPlugin. You can install it using npm or yarn like below;

yarn add @graphile/federation

and add those in your configuration file;

sources:
- name: MyDb
handler:
postgraphile:
connectionString: postgres://postgres:password@localhost/postgres
plugins:
- "@graphile/federation"

Use FederationPlugin only if you are using federation as merger as in Federation Recipe

Learn more about PostGraphile plugins

Config API Reference

  • connectionString (type: String, required) - A connection string to your Postgres database
  • schemaName (type: Array of String, required) - An array of strings which specifies the PostgreSQL schemas that PostGraphile will use to create a GraphQL schema. The default schema is the public schema.
  • pool (type: Object) - Connection Pool settings:
    • user (type: String)
    • password (type: String)
    • database (type: String)
    • host (type: String)
    • port (type: Int)
    • connectionString (type: String)
  • cacheIntrospection (type: Boolean) - Cache Introspection
  • plugins (type: Array of String) - Extra Postgraphile Plugins