python3-commons 0.8.7__py3-none-any.whl → 0.8.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python3_commons/db/__init__.py +6 -3
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/METADATA +1 -1
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/RECORD +7 -7
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/WHEEL +0 -0
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/licenses/AUTHORS.rst +0 -0
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/licenses/LICENSE +0 -0
- {python3_commons-0.8.7.dist-info → python3_commons-0.8.9.dist-info}/top_level.txt +0 -0
python3_commons/db/__init__.py
CHANGED
@@ -52,20 +52,23 @@ class AsyncSessionManager:
|
|
52
52
|
except KeyError:
|
53
53
|
logger.debug(f'Creating session maker: {name}')
|
54
54
|
engine = self.get_engine(name)
|
55
|
-
session_maker = async_sessionmaker(engine)
|
55
|
+
session_maker = async_sessionmaker(engine, expire_on_commit=False)
|
56
56
|
self.session_makers[name] = session_maker
|
57
57
|
|
58
58
|
return session_maker
|
59
59
|
|
60
60
|
def get_async_session(self, name: str) -> Callable[[], AsyncGenerator[AsyncSession, None]]:
|
61
61
|
async def get_session() -> AsyncGenerator[AsyncSession, None]:
|
62
|
-
|
62
|
+
session_maker = self.get_session_maker(name)
|
63
|
+
|
64
|
+
async with session_maker() as session:
|
63
65
|
yield session
|
64
66
|
|
65
67
|
return get_session
|
66
68
|
|
67
69
|
def get_session_context(self, name: str):
|
68
|
-
|
70
|
+
# TODO: cache
|
71
|
+
return contextlib.asynccontextmanager(self.get_async_session(name))
|
69
72
|
|
70
73
|
|
71
74
|
async def is_healthy(engine: AsyncEngine) -> bool:
|
@@ -6,7 +6,7 @@ python3_commons/fs.py,sha256=wfLjybXndwLqNlOxTpm_HRJnuTcC4wbrHEOaEeCo9Wc,337
|
|
6
6
|
python3_commons/helpers.py,sha256=OmuCF7UeJ6oe-rH1Y4ZYVW_uPQ973lCLsikj01wmNqs,3101
|
7
7
|
python3_commons/object_storage.py,sha256=Bte49twIJ4l6VAzIqK6tLx7DFYwijErUmmhWkrZpSJE,4074
|
8
8
|
python3_commons/permissions.py,sha256=V6kT7gBQ0fZRDQwreM9es90BvvpB3gUofuqnFvx2g-o,1553
|
9
|
-
python3_commons/db/__init__.py,sha256=
|
9
|
+
python3_commons/db/__init__.py,sha256=_SKKKf4uW4xYdSkL6Getow9ERGd_RYBlaM4xKEQKos8,2741
|
10
10
|
python3_commons/db/helpers.py,sha256=0z-pXAxQg0KqrqfoUcRooRHNrrKi-g2mSO6euVMscpE,1891
|
11
11
|
python3_commons/db/models/__init__.py,sha256=AeeTLUqdqQrhCTi14ACWO0ccyVyWFppZVtCeWShSvR0,193
|
12
12
|
python3_commons/db/models/auth.py,sha256=ctHiz_5x17TdXac7a3SjfuZ0-nEgnxK7RwKOY8qflZc,1195
|
@@ -19,9 +19,9 @@ python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
19
19
|
python3_commons/serializers/json.py,sha256=P288wWz9ic38QWEMrpp_uwKPYkQiOgvE1cI4WZn6ZCg,808
|
20
20
|
python3_commons/serializers/msgpack.py,sha256=tzIGGyDL3UpZnnouCtnxuYDx6InKM_C3PP1N4PN8wd4,1269
|
21
21
|
python3_commons/serializers/msgspec.py,sha256=FuZVqOLJb0-lEKrs7dtjhwEbHIpfMUk5yu1hD64zRdc,2038
|
22
|
-
python3_commons-0.8.
|
23
|
-
python3_commons-0.8.
|
24
|
-
python3_commons-0.8.
|
25
|
-
python3_commons-0.8.
|
26
|
-
python3_commons-0.8.
|
27
|
-
python3_commons-0.8.
|
22
|
+
python3_commons-0.8.9.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
|
23
|
+
python3_commons-0.8.9.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
|
24
|
+
python3_commons-0.8.9.dist-info/METADATA,sha256=SD0hFz7Gcz3JCB9LujpYhyyEQql-5cln8XOMSxjHYFU,1149
|
25
|
+
python3_commons-0.8.9.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
26
|
+
python3_commons-0.8.9.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
|
27
|
+
python3_commons-0.8.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|