Installation
Install the Supabase Python client library:Initializing
Create a Supabase client to interact with your database.str
required
The unique Supabase URL for your project.
str
required
The Supabase anon key or service role key for your project.
ClientOptions
Optional configuration parameters.
Database Operations
Select Data
Query data from your tables.list
The returned rows from the query.
int | None
The total count of rows (if count option is specified).
Select with Filters
Select with Joins
Common Filters
Insert Data
Insert rows into your tables.dict | list[dict]
required
The values to insert. Can be a single dictionary or a list of dictionaries.
list
The inserted rows.
Insert Multiple Rows
Update Data
Update existing rows in your tables.dict
required
The values to update.
Upsert Data
Insert or update rows based on unique constraints.str
Specify which columns should be used for the conflict resolution.
Delete Data
Delete rows from your tables.Authentication
Sign Up
Create a new user account.str
required
The user’s email address.
str
required
The user’s password.
dict
Optional parameters.
User | None
The user object.
Session | None
The session object.
Sign In
Sign in an existing user.Sign Out
Sign out the current user.Get Session
Get the current session.Session | None
The current session object or None if no active session.
Get User
Get the current user.User | None
The current user object or None if not authenticated.
Storage
Upload File
Upload a file to a storage bucket.str
required
The file path including the file name.
bytes | BinaryIO
required
The file data to upload.
dict
Upload options.
Download File
Download a file from storage.str
required
The file path to download.
bytes
The file data as bytes.
List Files
List all files in a bucket.Delete Files
Delete files from storage.Get Public URL
Get the public URL for a file.Realtime
Subscribe to Changes
Listen to database changes in realtime.str
required
The database event to listen for:
INSERT, UPDATE, DELETE, or * for all.Callable
required
Function to call when an event occurs.
Unsubscribe
Stop listening to changes.Edge Functions
Invoke Function
Invoke a Supabase Edge Function.str
required
The name of the Edge Function to invoke.
dict
Function invocation options.
any
The response data from the function.
Type Hints
The Python client supports type hints:Error Handling
Handle errors using try-except blocks:Async Support
Use the async client for asynchronous operations:Additional Resources
GitHub Repository
View the source code and contribute
PyPI Package
View package details and versions
