• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AndreuCodina / wirio / 22077718946

16 Feb 2026 09:15PM UTC coverage: 96.87% (-1.7%) from 98.52%
22077718946

Pull #52

github

web-flow
Merge a0f134d3c into a7070b205
Pull Request #52: Add SQLModel integration

259 of 260 branches covered (99.62%)

Branch coverage included in aggregate %.

24 of 68 new or added lines in 5 files covered. (35.29%)

1 existing line in 1 file now uncovered.

2341 of 2424 relevant lines covered (96.58%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/wirio/integrations/_sqlmodel_integration.py
NEW
1
from typing import TYPE_CHECKING, final
×
2

NEW
3
from sqlalchemy import Engine
×
NEW
4
from sqlalchemy.ext.asyncio import (
×
5
    AsyncEngine,
6
    async_sessionmaker,
7
    create_async_engine,
8
)
NEW
9
from sqlalchemy.orm import Session, sessionmaker
×
NEW
10
from sqlmodel import create_engine
×
NEW
11
from sqlmodel.ext.asyncio.session import AsyncSession
×
12

13
if TYPE_CHECKING:
14
    from wirio.service_collection import ServiceCollection
15

16

NEW
17
@final
×
NEW
18
class SqlmodelIntegration:
×
NEW
19
    @staticmethod
×
NEW
20
    def add_async_services(
×
21
        services: "ServiceCollection",
22
        connection_string: str,
23
        *,
24
        expire_on_commit: bool = False,
25
        autoflush: bool = True,
26
    ) -> None:
NEW
27
        def inject_async_engine() -> AsyncEngine:
×
NEW
28
            return create_async_engine(url=connection_string)
×
29

NEW
30
        services.add_singleton(inject_async_engine)
×
31

NEW
32
        def inject_async_sessionmaker(
×
33
            async_engine: AsyncEngine,
34
        ) -> async_sessionmaker[AsyncSession]:
NEW
35
            return async_sessionmaker(
×
36
                bind=async_engine,
37
                class_=AsyncSession,
38
                expire_on_commit=expire_on_commit,
39
                autoflush=autoflush,
40
            )
41

NEW
42
        services.add_singleton(inject_async_sessionmaker)
×
43

NEW
44
        def inject_async_session(
×
45
            async_sessionmaker: async_sessionmaker[AsyncSession],
46
        ) -> AsyncSession:
NEW
47
            return async_sessionmaker()
×
48

NEW
49
        services.add_scoped(inject_async_session)
×
50

NEW
51
    @staticmethod
×
NEW
52
    def add_sync_services(
×
53
        services: "ServiceCollection",
54
        connection_string: str,
55
        *,
56
        expire_on_commit: bool = True,
57
        autoflush: bool = True,
58
    ) -> None:
NEW
59
        def inject_engine() -> Engine:
×
NEW
60
            return create_engine(url=connection_string)
×
61

NEW
62
        services.add_singleton(inject_engine)
×
63

NEW
64
        def inject_sessionmaker(
×
65
            engine: Engine,
66
        ) -> sessionmaker[Session]:
NEW
67
            return sessionmaker(
×
68
                bind=engine,
69
                class_=Session,
70
                expire_on_commit=expire_on_commit,
71
                autoflush=autoflush,
72
            )
73

NEW
74
        services.add_singleton(inject_sessionmaker)
×
75

NEW
76
        def inject_session(
×
77
            sessionmaker: sessionmaker[Session],
78
        ) -> Session:
NEW
79
            return sessionmaker()
×
80

NEW
81
        services.add_scoped(inject_session)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc