Skip to main content

A collection of framework specific utilities for working with Supabase.

Project description

supabase-utils

A collection of framework specific utilities for working with Supabase.

Installation

pip supabase-utils

Usage

from sb_utils import sb_table


accounts = sb_table("accounts").select("id, title, created_by(username)", count="exact")

for account in accounts.data:
  print(account.get("title"))
from pydantic import BaseModel
from sb_utils import BaseService


class User(BaseModel):
    __tablename__ = "users"

    id: Optional[str] = Field(default=None, primary_key=True)
    username: str


class Account(BaseModel):
    __tablename__ = "accounts"

    id: Optional[str] = Field(default=None, primary_key=True)
    title: str
    created_by: User = Field(related_name="username")


class AccountService(BaseService):
    model = Account


accounts = AccountService.all()

for account in accounts:
  print(account.title)

Documentation

Community

License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sb_utils-0.1.1.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

sb_utils-0.1.1-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page