rb-commons 0.5.23__py3-none-any.whl → 0.5.25__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.
@@ -97,6 +97,14 @@ class BaseManager(Generic[ModelType]):
97
97
  return None
98
98
 
99
99
  def _parse_lookup(self, lookup: str, value: Any):
100
+ root = lookup.split("__", 1)[0]
101
+
102
+ if hasattr(self.model, root):
103
+ attr0 = getattr(self.model, root)
104
+ if hasattr(attr0, "property") and isinstance(attr0.property, RelationshipProperty):
105
+ self._joins.add(root)
106
+ parts = lookup.split("__")
107
+
100
108
  parts = lookup.split("__")
101
109
  operator = "eq"
102
110
  if parts[-1] in {"eq", "ne", "gt", "lt", "gte", "lte", "in", "contains", "null"}:
@@ -468,9 +476,13 @@ class BaseManager(Generic[ModelType]):
468
476
  async def is_exists(self):
469
477
  self._ensure_filtered()
470
478
 
471
- stmt = select(self.model).filter(and_(*self.filters))
479
+ stmt = (
480
+ select(self.model)
481
+ .filter(and_(*self.filters))
482
+ .limit(1)
483
+ )
472
484
  result = await self.session.execute(stmt)
473
- return result.scalar_one_or_none() is not None
485
+ return result.scalars().first() is not None
474
486
 
475
487
  def has_relation(self, relation_name: str):
476
488
  relationship = getattr(self.model, relation_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rb-commons
3
- Version: 0.5.23
3
+ Version: 0.5.25
4
4
  Summary: Commons of project and simplified orm based on sqlalchemy.
5
5
  Home-page: https://github.com/RoboSell-organization/rb-commons
6
6
  Author: Abdulvoris
@@ -13,7 +13,7 @@ rb_commons/http/consul.py,sha256=Ioq72VD1jGwoC96set7n2SgxN40olzI-myA2lwKkYi4,186
13
13
  rb_commons/http/exceptions.py,sha256=EGRMr1cRgiJ9Q2tkfANbf0c6-zzXf1CD6J3cmCaT_FA,1885
14
14
  rb_commons/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  rb_commons/orm/exceptions.py,sha256=1aMctiEwrPjyehoXVX1l6ML5ZOhmDkmBISzlTD5ey1Y,509
16
- rb_commons/orm/managers.py,sha256=5GyVoy6QR7GfxiW77PM7Tj5xjv7DVdP9Vqx56lruwIY,19456
16
+ rb_commons/orm/managers.py,sha256=vELttfVNHoBOeFLV5XmBh4cS_1PAYAPfyCLbBDkzjc0,19827
17
17
  rb_commons/orm/services.py,sha256=71eRcJ4TxZvzNz-hLXo12X4U7PGK54ZfbLAb27AjZi8,1589
18
18
  rb_commons/permissions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  rb_commons/permissions/role_permissions.py,sha256=4dV89z6ggzLqCCiFYlMp7kQVJRESu6MHpkT5ZNjLo6A,1096
@@ -22,7 +22,7 @@ rb_commons/schemes/jwt.py,sha256=ZKLJ5D3fcEmEKySjzbxEgUcza4K-oPoHr14_Z0r9Yic,249
22
22
  rb_commons/schemes/pagination.py,sha256=8VZW1wZGJIPR9jEBUgppZUoB4uqP8ORudHkMwvEJSxg,1866
23
23
  rb_commons/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  rb_commons/utils/media.py,sha256=J2Zi0J28DhcVQVzt-myNNVuzj9Msaetul53VjZtdDdc,820
25
- rb_commons-0.5.23.dist-info/METADATA,sha256=-qBqDrrier-vQhcQ6p8RIn0cugXYsSJW1f66NTounk8,6571
26
- rb_commons-0.5.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- rb_commons-0.5.23.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
28
- rb_commons-0.5.23.dist-info/RECORD,,
25
+ rb_commons-0.5.25.dist-info/METADATA,sha256=DQmBk2r4PKfLLFtGYRYuUF266dCEu86o-KR5bQHkYqE,6571
26
+ rb_commons-0.5.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ rb_commons-0.5.25.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
28
+ rb_commons-0.5.25.dist-info/RECORD,,