Skip to content

SupabaseClient

SupabaseClient

SupabaseClient(table_name: str)

Bases: BaseClient

Client for interacting with a Supabase database.

This client provides methods for performing common database operations using the Supabase client library. It inherits from BaseClient and implements the abstract methods defined there.

This client relies on environment variables SUPABASE_URL and SUPABASE_KEY to initialize the Supabase client.

Parameters:

Name Type Description Default
table_name str

The name of the table to interact with.

required
Source code in supadantic/clients/supabase.py
28
29
30
31
32
33
34
35
36
37
38
39
40
def __init__(self, table_name: str):
    """
    Initializes the Supabase client and sets up the query object.

    Args:
        table_name (str): The name of the table to interact with.
    """

    super().__init__(table_name=table_name)
    url: str = os.getenv('SUPABASE_URL', default='')
    key: str = os.getenv('SUPABASE_KEY', default='')
    supabase_client = create_client(url, key)
    self.query = supabase_client.table(table_name=self.table_name)