rb-commons 0.7.15__tar.gz → 0.7.16__tar.gz
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.
- {rb_commons-0.7.15 → rb_commons-0.7.16}/PKG-INFO +1 -1
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/managers.py +28 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons.egg-info/PKG-INFO +1 -1
- {rb_commons-0.7.15 → rb_commons-0.7.16}/setup.py +1 -1
- {rb_commons-0.7.15 → rb_commons-0.7.16}/README.md +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/broker/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/broker/consumer.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/config.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/injections.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/rabbitmq.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/v2/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/configs/v2/config.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/http/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/http/base_api.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/http/consul.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/http/exceptions.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/enum.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/exceptions.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/querysets.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/orm/services.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/permissions/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/permissions/role_permissions.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/schemes/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/schemes/jwt.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/schemes/pagination.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/utils/__init__.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons/utils/media.py +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons.egg-info/SOURCES.txt +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons.egg-info/dependency_links.txt +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons.egg-info/requires.txt +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/rb_commons.egg-info/top_level.txt +0 -0
- {rb_commons-0.7.15 → rb_commons-0.7.16}/setup.cfg +0 -0
@@ -136,6 +136,34 @@ class BaseManager(Generic[ModelType]):
|
|
136
136
|
|
137
137
|
def _parse_lookup(self, lookup: str, value: Any):
|
138
138
|
parts, operator, rel_attr, col_attr = self._parse_lookup_meta(lookup)
|
139
|
+
|
140
|
+
if rel_attr is not None and col_attr is None:
|
141
|
+
uselist = rel_attr.property.uselist
|
142
|
+
primaryjoin = rel_attr.property.primaryjoin
|
143
|
+
|
144
|
+
if uselist:
|
145
|
+
target_cls = rel_attr.property.mapper.class_
|
146
|
+
cnt = (
|
147
|
+
select(func.count("*"))
|
148
|
+
.select_from(target_cls)
|
149
|
+
.where(primaryjoin)
|
150
|
+
.correlate(self.model)
|
151
|
+
.scalar_subquery()
|
152
|
+
)
|
153
|
+
return self._build_comparison(cnt, operator, value)
|
154
|
+
else:
|
155
|
+
exists_expr = (
|
156
|
+
select(1)
|
157
|
+
.where(primaryjoin)
|
158
|
+
.correlate(self.model)
|
159
|
+
.exists()
|
160
|
+
)
|
161
|
+
if operator in {"eq", "lte"} and str(value) in {"0", "False", "false"}:
|
162
|
+
return ~exists_expr
|
163
|
+
if operator in {"gt", "gte", "eq"} and str(value) in {"1", "True", "true"}:
|
164
|
+
return exists_expr
|
165
|
+
return self._build_comparison(exists_expr, operator, bool(value))
|
166
|
+
|
139
167
|
expr = self._build_comparison(col_attr, operator, value)
|
140
168
|
|
141
169
|
if rel_attr:
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="rb-commons",
|
8
|
-
version="0.7.
|
8
|
+
version="0.7.16",
|
9
9
|
author="Abdulvoris",
|
10
10
|
author_email="erkinovabdulvoris101@gmail.com",
|
11
11
|
description="Commons of project and simplified orm based on sqlalchemy.",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|