Creating JSON Extracts in Supabase

8 minute read Published

How to upload and extract JSON using Postgres trigger functions in Supabase.

I loved my database courses in college. 20 years ago I could have written you a perfectly normalized relational database with a binder full of DB2 SQL queries that looked like magic. Since then much of that knowledge has begun to escape me as I haven’t had a strong desire to delve back into databases. Not because I don’t find them fascinating. But because getting them up correctly can be a pain.

Fast-forward a few years and DB2 has been superseded by Postgres and thanks to Supabase making relational databases super easy to set-up I find myself reaching back for that DB structures knowledge once again. Only now we’ll be working with something that didn’t exist back then: JSON.

In this post I’ll explain how to upload and extract JSON data into rows in a Postgres database using SvelteKit and Supabase. And though processing data this way seems like it would be a fairly common task, I wasn’t able to find a guide online describing how to do this. As a result, I thought it worthwhile to jot down how to do it.

Activate and Use Supabase GraphQL

4 minute read Updated

How to Activate and Use Supabase GraphQL. Just the basics.
For the uninitiated Supabase is a open source Firebase alternative. That’s a rather bold statement and it has caused some long-time fans of Firebase, a Google product, to raise an eyebrow. Yet despite who’s talking about it or not one thing is for certain: Supabase is moving quick. As of March 28th all new projects created within Supabase have access to GraphQL via an extension for Postgres. And projects that were created beforehand can install the extension themselves if desired.