It is an extension of the bisslog library to support processes with the Supabase service using the official Python SDK.
Project description
Business logic - Supabase (bisslog-supabase-py)
It is an extension of the bisslog library to support processes with the Supabase service using the official Python SDK.
If you want to know more about what bisslog is, you can enter here or in their library
🚀 Installation
You can install bisslog-supabase-py using pip:
pip install bisslog-supabase-py
Usage example
import os
from supabase import create_client
from abc import ABC, abstractmethod
from bisslog import Division, bisslog_db
from bisslog_supabase import BasicSupabaseHelper, bisslog_exc_mapper_supabase
class MarketingDivision(Division, ABC):
@abstractmethod
def find_sales_per_client(self, email: str):
raise NotImplementedError("find_sales_per_client must be implemented")
class MarketingSupabaseDivision(MarketingDivision, BasicSupabaseHelper):
@bisslog_exc_mapper_supabase
def find_sales_per_client(self, email: str):
return self.find_one("sales", {"email": email})
supabase_url = os.environ["SUPABASE_URL"]
supabase_key = os.environ["SUPABASE_SERVICE_ROLE"]
client = create_client(supabase_url, supabase_key)
marketing_div = MarketingSupabaseDivision(client)
bisslog_db.register_adapters(marketing=marketing_div)
Components
BasicSupabaseHelper
BasicSupabaseHelper is a helper class for interacting with Supabase tables via the official SDK.
It provides convenient methods for performing insert, query, and count operations while maintaining traceability through TransactionTraceable.
Initialization
BasicSupabaseHelper(client: SupabaseClient)
Initializes the helper with a SupabaseClient instance.
Methods
insert_one
insert_one(table: str, data: dict) -> Optional[dict]
Inserts a record into the specified table and returns the inserted data or None.
find_one
find_one(table: str, filters: dict) -> Optional[dict]
Fetches a single row matching the filters or returns None.
get_length
get_length(table: str, filters: Optional[dict] = None) -> int
Returns the number of matching rows in the given table.
bisslog_exc_mapper_supabase
Decorator to map Supabase or HTTPX exceptions to their corresponding Bisslog exceptions.
| Exception (httpx/Supabase) | Mapped Bisslog Exception |
|---|---|
HTTPStatusError 400 |
InvalidDataExtException |
HTTPStatusError 401 |
ConfigurationExtException |
HTTPStatusError 403/404 |
ProgrammingErrorExtException |
HTTPStatusError 409 |
IntegrityErrorExtException |
HTTPStatusError 5xx |
OperationalErrorExtException |
TimeoutException |
TimeoutExtException |
RequestError |
ConnectionExtException |
Exception (fallback) |
ExternalInteractionError |
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bisslog_supabase-0.0.0.tar.gz.
File metadata
- Download URL: bisslog_supabase-0.0.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac20b6ed4fecf0a0fe276f954c930392127fb2e9072821b79d408dced7d22acd
|
|
| MD5 |
6395cb3c158913ce5abc7dbcfb8f5ebb
|
|
| BLAKE2b-256 |
9d12a12482def2b1cf73912fabe001e483b8fad67a51f037d18effb53e1c842b
|
File details
Details for the file bisslog_supabase-0.0.0-py3-none-any.whl.
File metadata
- Download URL: bisslog_supabase-0.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fcfa8a6ac93ed45accac2d68f100eda276294f015a774a6607bdff7d00a5288
|
|
| MD5 |
425c319e02a7c661487aa5bc547ec702
|
|
| BLAKE2b-256 |
f4b19f683ff41eba58e08100303e254edef57ca8a55b7629ee672eb32f96aa99
|