For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
range() queries to paginate through your data.select() can be combined with Modifiersselect() can be combined with Filtersapikey is technically a reserved keyword, since the API gateway will pluck it out for authentication. It should be avoided as a column name.Codable to easily decode your database responses.struct Instrument: Decodable {
let id: Int
let name: String
}
let instruments: [Instrument] = try await supabase
.from("instruments")
.select()
.execute()
.value
struct Instrument: Decodable {
let name: String
}
let instruments: [Instrument] = try await supabase
.from("instruments")
.select("name")
.execute()
.value
struct OrchestralSection: Decodable {
let name: String
let instruments: [Instrument]
}
struct Instrument: Decodable {
let name: String
}
let orchestralSections: [OrchestralSection] = try await supabase
.from("orchestral_sections")
.select(
"""
name,
instruments (
name
)
"""
)
.execute()
.value
struct User: Decodable {
let name: String
let teams: [Team]
}
struct Team: Decodable {
let name: String
}
let users: [User] = try await supabase
.from("users")
.select(
"""
name,
teams (
name
)
"""
)
.execute()
.value
struct Message: Decodable {
let content: String
let from: User
let to: User
}
struct User: Decodable {
let name: String
}
let messages: [Message] = try await supabase
.from("messages")
.select(
"""
content,
from:sender_id(name),
to:sended_id(name)
"""
)
.execute()
.value
struct Instrument: Decodable {
let name: String
let orchestralSections: [OrchestralSection]?
}
struct OrchestralSection: Decodable {
let name: String
}
let instruments: [Instrument] = try await supabase
.from("instruments")
.select("name, orchestral_sections(*)")
.eq("orchestral_sections.name", value: "percussion")
.execute()
.value
struct OrchestralSection: Decodable {
let id: UUID
let name: String
let instruments: [Instrument]
}
struct Instrument: Decodable {
let count: Int
}
let orchestralSections: [OrchestralSection] = try await supabase
.from("orchestral_sections")
.select("*, instruments(count)")
.execute()
.value
let count = try await supabase
.from("instruments")
.select("*", head: true, count: .exact)
.execute()
.count
struct User: Decodable {
let id: Int
let name: String
let city: String
}
let users: [User] = try await supabase
.from("users")
.select(
"""
id, name,
address->city
"""
)
.execute()
.value
struct Instrument: Decodable {
let name: String
}
struct OrchestralSection: Decodable {
let name: String
let instruments: [Instrument]
}
let orchestralSections: [OrchestralSection] = try await supabase
.from("orchestral_sections")
.select("name, instruments!inner(name)")
.eq("name", value: "strings")
.execute()
.value
try await supabase
.schema("myschema")
.from("mytable")
.select()