Supabase
Setup
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(supabase_url, anon_key)Querying
//basic query
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.gte('population', 1000)
.lt('population', 10000)
//if politician has an id linking to ballot_item or its through a composite key join table(nothing needs to be set to differentiate)
const { data, error } = await supabase.from("ballot_item").select(`
*,
politician (*)
`)
.eq('politician.first_name', 'Donald');
//query JSON
const { data, error } = await supabase
.from('users')
.select(`
id, name,
address->city
`)Insert
Postgres Functions
Extra
Last updated