https://github.com/alexdemure/gadsqlalchemy
Wrapper around SQLAlchemy AsyncSession with built-in query execution profiling and connection context management
https://github.com/alexdemure/gadsqlalchemy
python-sqlaclhemy sqlaclhemy sqlalchemy-python
Last synced: about 1 year ago
JSON representation
Wrapper around SQLAlchemy AsyncSession with built-in query execution profiling and connection context management
- Host: GitHub
- URL: https://github.com/alexdemure/gadsqlalchemy
- Owner: AlexDemure
- License: mit
- Created: 2025-04-29T06:31:26.000Z (about 1 year ago)
- Default Branch: production
- Last Pushed: 2025-04-29T10:45:19.000Z (about 1 year ago)
- Last Synced: 2025-04-29T11:02:27.019Z (about 1 year ago)
- Topics: python-sqlaclhemy, sqlaclhemy, sqlalchemy-python
- Language: Python
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Wrapper around SQLAlchemy AsyncSession with built-in query execution profiling and connection context management.
---
### Installation
```
pip install gadsqlalchemy
```
### Usage
```python
# logger: sqlalchemy.profiler
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",
]
```
