Skip to content

supabase/pg_graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2b68b46 · Feb 20, 2025
Sep 27, 2024
Jul 29, 2023
Feb 3, 2025
Jul 31, 2023
Feb 3, 2025
Feb 20, 2025
Feb 20, 2025
Jan 23, 2025
Feb 3, 2025
Sep 2, 2021
Oct 18, 2022
Jun 14, 2023
Oct 17, 2022
Feb 20, 2025
Feb 20, 2025
Aug 5, 2021
Oct 1, 2024
Oct 18, 2022
Oct 22, 2023
Mar 6, 2023

pg_graphql

PostgreSQL version License tests


Documentation: https://supabase.github.io/pg_graphql

Source Code: https://github.com/supabase/pg_graphql


pg_graphql adds GraphQL support to your PostgreSQL database.

  • Performant
  • Consistent
  • Serverless
  • Open Source

Overview

pg_graphql reflects a GraphQL schema from the existing SQL schema.

The extension keeps schema translation and query resolution neatly contained on your database server. This enables any programming language that can connect to PostgreSQL to query the database via GraphQL with no additional servers, processes, or libraries.

TL;DR

The SQL schema

create table account(
    id serial primary key,
    email varchar(255) not null,
    created_at timestamp not null,
    updated_at timestamp not null
);

create table blog(
    id serial primary key,
    owner_id integer not null references account(id),
    name varchar(255) not null,
    description varchar(255),
    created_at timestamp not null,
    updated_at timestamp not null
);

create type blog_post_status as enum ('PENDING', 'RELEASED');

create table blog_post(
    id uuid not null default uuid_generate_v4() primary key,
    blog_id integer not null references blog(id),
    title varchar(255) not null,
    body varchar(10000),
    status blog_post_status not null,
    created_at timestamp not null,
    updated_at timestamp not null
);

Translates into a GraphQL schema displayed below.

Each table receives an entrypoint in the top level Query type that is a pageable collection with relationships defined by its foreign keys. Tables similarly recieve entrypoints in the Mutation schema that enable bulk operations for insert, update, and delete.

GraphiQL

Contributing

Please refer to the contributing docs for more information.