# Business logic - Supabase (bisslog-supabase-py)
[](https://pypi.org/project/bisslog-supabase-py/)
[](LICENSE)
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](https://github.com/darwinhc/bisslog-docs) or in their [library](https://github.com/darwinhc/bisslog-core-py)
---
## 🚀 Installation
You can install `bisslog-supabase-py` using **pip**:
```bash
pip install bisslog-supabase-py
```
## Usage example
~~~python
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**
~~~python
BasicSupabaseHelper(client: SupabaseClient)
~~~
Initializes the helper with a `SupabaseClient` instance.
#### **Methods**
- `insert_one`
~~~python
insert_one(table: str, data: dict) -> Optional[dict]
~~~
Inserts a record into the specified table and returns the inserted data or None.
- `find_one`
~~~python
find_one(table: str, filters: dict) -> Optional[dict]
~~~
Fetches a single row matching the filters or returns None.
- `get_length`
~~~python
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](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "bisslog-supabase",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "hexagonal, adapters, supabase",
"author": null,
"author_email": "Darwin Stiven Herrera Cartagena <darwinsherrerac@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9d/12/a12482def2b1cf73912fabe001e483b8fad67a51f037d18effb53e1c842b/bisslog_supabase-0.0.0.tar.gz",
"platform": null,
"description": "# Business logic - Supabase (bisslog-supabase-py)\n\n[](https://pypi.org/project/bisslog-supabase-py/)\n[](LICENSE)\n\nIt is an extension of the bisslog library to support processes with the Supabase service using the official Python SDK.\n\nIf you want to know more about what bisslog is, you can enter [here](https://github.com/darwinhc/bisslog-docs) or in their [library](https://github.com/darwinhc/bisslog-core-py)\n\n---\n\n## \ud83d\ude80 Installation\nYou can install `bisslog-supabase-py` using **pip**:\n\n```bash\npip install bisslog-supabase-py\n```\n\n## Usage example\n\n~~~python\nimport os\nfrom supabase import create_client\nfrom abc import ABC, abstractmethod\nfrom bisslog import Division, bisslog_db\nfrom bisslog_supabase import BasicSupabaseHelper, bisslog_exc_mapper_supabase\n\n\nclass MarketingDivision(Division, ABC):\n\n @abstractmethod\n def find_sales_per_client(self, email: str):\n raise NotImplementedError(\"find_sales_per_client must be implemented\")\n\n\nclass MarketingSupabaseDivision(MarketingDivision, BasicSupabaseHelper):\n\n @bisslog_exc_mapper_supabase\n def find_sales_per_client(self, email: str):\n return self.find_one(\"sales\", {\"email\": email})\n\n\nsupabase_url = os.environ[\"SUPABASE_URL\"]\nsupabase_key = os.environ[\"SUPABASE_SERVICE_ROLE\"]\nclient = create_client(supabase_url, supabase_key)\n\nmarketing_div = MarketingSupabaseDivision(client)\nbisslog_db.register_adapters(marketing=marketing_div)\n~~~\n\n## Components\n\n### BasicSupabaseHelper\n\n`BasicSupabaseHelper` is a helper class for interacting with Supabase tables via the official SDK. \nIt provides convenient methods for performing insert, query, and count operations while maintaining traceability through `TransactionTraceable`.\n\n#### **Initialization**\n~~~python\nBasicSupabaseHelper(client: SupabaseClient)\n~~~\n\nInitializes the helper with a `SupabaseClient` instance.\n\n#### **Methods**\n\n- `insert_one`\n~~~python\ninsert_one(table: str, data: dict) -> Optional[dict]\n~~~\nInserts a record into the specified table and returns the inserted data or None.\n\n- `find_one`\n~~~python\nfind_one(table: str, filters: dict) -> Optional[dict]\n~~~\nFetches a single row matching the filters or returns None.\n\n- `get_length`\n~~~python\nget_length(table: str, filters: Optional[dict] = None) -> int\n~~~\nReturns the number of matching rows in the given table.\n\n### bisslog_exc_mapper_supabase\n\nDecorator to map Supabase or HTTPX exceptions to their corresponding Bisslog exceptions.\n\n| **Exception (httpx/Supabase)** | **Mapped Bisslog Exception** |\n|-------------------------------|-------------------------------------|\n| `HTTPStatusError 400` | `InvalidDataExtException` |\n| `HTTPStatusError 401` | `ConfigurationExtException` |\n| `HTTPStatusError 403/404` | `ProgrammingErrorExtException` |\n| `HTTPStatusError 409` | `IntegrityErrorExtException` |\n| `HTTPStatusError 5xx` | `OperationalErrorExtException` |\n| `TimeoutException` | `TimeoutExtException` |\n| `RequestError` | `ConnectionExtException` |\n| `Exception` (fallback) | `ExternalInteractionError` |\n\n## \ud83d\udcdc License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "It is an extension of the bisslog library to support processes with the Supabase service using the official Python SDK.",
"version": "0.0.0",
"project_urls": {
"Homepage": "https://github.com/darwinhc/bisslog-supabase-py"
},
"split_keywords": [
"hexagonal",
" adapters",
" supabase"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f4b19f683ff41eba58e08100303e254edef57ca8a55b7629ee672eb32f96aa99",
"md5": "425c319e02a7c661487aa5bc547ec702",
"sha256": "4fcfa8a6ac93ed45accac2d68f100eda276294f015a774a6607bdff7d00a5288"
},
"downloads": -1,
"filename": "bisslog_supabase-0.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "425c319e02a7c661487aa5bc547ec702",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5772,
"upload_time": "2025-07-08T11:37:06",
"upload_time_iso_8601": "2025-07-08T11:37:06.192863Z",
"url": "https://files.pythonhosted.org/packages/f4/b1/9f683ff41eba58e08100303e254edef57ca8a55b7629ee672eb32f96aa99/bisslog_supabase-0.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9d12a12482def2b1cf73912fabe001e483b8fad67a51f037d18effb53e1c842b",
"md5": "6395cb3c158913ce5abc7dbcfb8f5ebb",
"sha256": "ac20b6ed4fecf0a0fe276f954c930392127fb2e9072821b79d408dced7d22acd"
},
"downloads": -1,
"filename": "bisslog_supabase-0.0.0.tar.gz",
"has_sig": false,
"md5_digest": "6395cb3c158913ce5abc7dbcfb8f5ebb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 9191,
"upload_time": "2025-07-08T11:37:07",
"upload_time_iso_8601": "2025-07-08T11:37:07.353823Z",
"url": "https://files.pythonhosted.org/packages/9d/12/a12482def2b1cf73912fabe001e483b8fad67a51f037d18effb53e1c842b/bisslog_supabase-0.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-08 11:37:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "darwinhc",
"github_project": "bisslog-supabase-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "supabase",
"specs": []
},
{
"name": "bisslog",
"specs": [
[
">=",
"0.0.7"
]
]
},
{
"name": "httpx",
"specs": []
}
],
"lcname": "bisslog-supabase"
}