Postgres
The Postgres connector allows you to connect one or more Postgres databases to Grafbase, and instantly generate a GraphQL API for all tables.
The Postgres connector accepts the following config:
name
(required) — The unique name for the data sourceurl
(required) — The connection string used for your Postgres database
import { config, connector, graph } from '@grafbase/sdk'
const g = graph.Standalone()
const pg = connector.Postgres('Postgres', {
url: g.env('DATABASE_URL'),
})
g.datasource(pg)
export default config({ graph: g })
Grafbase automatically generates a GraphQL API schema to read and write to your Postgres database using the tables it found during the introspection of your database schema on startup.