Python: Fetch data

Parameters

Examples

Getting your data

response = supabase.table("countries").select("*").execute()

Selecting specific columns

response = supabase.table("countries").select("name").execute()

Query referenced tables

response = supabase.table("countries").select("name, cities(name)").execute()

Query referenced tables through a join table

response = supabase.table("users").select("name, teams(name)").execute()

Query the same referenced table multiple times

response = (
    supabase.table("messages")
    .select("content,from:sender_id(name),to:receiver_id(name)")
    .execute()
)

Filtering through referenced tables

response = (
    supabase.table("cities")
    .select("name, countries(*)")
    .eq("countries.name", "Estonia")
    .execute()
)

Querying referenced table with count

response = supabase.table("countries").select("*, cities(count)").execute()

Querying with count option

response = supabase.table("countries").select("*", count="exact").execute()

Querying JSON data

response = supabase.table("users").select("id, name, address->city").execute()

Querying referenced table with inner join

response = (
    supabase.table("cities")
    .select("name, countries!inner(name)")
    .eq("countries.name", "Indonesia")
    .execute()
)

Switching schemas per query

response = supabase.schema("myschema").table("mytable").select("*").execute()