This repository contains a collection of Python scripts that demonstrate the use of Supabase, a PostgreSQL database-as-a-service, in various scenarios.
Supabase is a PostgreSQL database-as-a-service that provides a simple and intuitive API for interacting with your database. This repository contains a collection of Python scripts that demonstrate the use of Supabase in various scenarios, including CRUD (Create, Read, Update, Delete) operations, authentication, and function invocation.
- Python 3.8 or later
- Supabase account with a PostgreSQL database
supabaseandgotruelibraries installed (pip install supabase gotrue)
This script demonstrates basic CRUD operations on a Supabase database. It creates a new table, inserts a new row, reads the row, and updates the row.
This script demonstrates authentication with Supabase using the gotrue library. It signs up a new user, signs in with a password, and prints the session token.
This script demonstrates the invocation of a Supabase function using the supabase.functions() method. It invokes a function named hello-world and prints the response.
To run these scripts, you will need to set the following environment variables:
SUPABASE_URL: the URL of your Supabase databaseSUPABASE_KEY: the API key for your Supabase database
You can set these variables in a .env file in the root of the repository, or in your operating system's environment variables.
- Clone this repository to your local machine.
- Create a new Supabase account and database.
- Set the
SUPABASE_URLandSUPABASE_KEYenvironment variables. - Run the scripts using Python (e.g.
python 01_crud_example.py).
Note: Make sure to replace the credentials dictionary in 02_auth.py with your own email and password.