Wrapper around SQLAlchemy AsyncSession with built-in query execution profiling and connection context management.
Project description
Wrapper around SQLAlchemy AsyncSession with built-in query execution profiling and connection context management.
Installation
pip install gadsqlalchemy
Usage
from gadsqlalchemy import Sqlalchemy, Base, CRUD
alchemy = Sqlalchemy("postgresql+asyncpg://postgres:postgres@localhost:5432/db")
class Table(Base):
...
class Crud(CRUD):
table = Table
class Service:
@classmethod
async def get(cls):
async with alchemy.connect() as session:
...
@classmethod
async def create(cls,):
async with alchemy.connect(transaction=True) as session:
...
# testing
import faker
from gadsqlalchemy.testing import Table
fake = faker.Faker()
class Dummy(Table):
class Meta:
model = Table
name = fake.name()
pytest_plugins = [
"gadsqlalchemy.testing.fixtures",
]
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
gadsqlalchemy-0.0.3.tar.gz
(6.4 kB
view details)
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 gadsqlalchemy-0.0.3.tar.gz.
File metadata
- Download URL: gadsqlalchemy-0.0.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89137c035448a34ac1b068db15bbd5851e456dcf151412cc5edd127168467a67
|
|
| MD5 |
a2fd7d7f2e1e790584d025a035064b8b
|
|
| BLAKE2b-256 |
634e4c8ba6570a368437e5e01322b5376c723afbf07a9bf015ae4645450b3181
|
File details
Details for the file gadsqlalchemy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: gadsqlalchemy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f80f26ea4a8e115caef1ee498f1dc19b699f4e860fa88179cc175fe89e6e3a32
|
|
| MD5 |
a23681b3f515c98c6af2148885af18d9
|
|
| BLAKE2b-256 |
9904a46cc829be5bdc61c9d46917707721da86ae70ced30cfc0b12b8d4330d7f
|