maleo-foundation 0.2.55__py3-none-any.whl → 0.2.56__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.
- maleo_foundation/utils/query.py +7 -3
- {maleo_foundation-0.2.55.dist-info → maleo_foundation-0.2.56.dist-info}/METADATA +1 -1
- {maleo_foundation-0.2.55.dist-info → maleo_foundation-0.2.56.dist-info}/RECORD +5 -5
- {maleo_foundation-0.2.55.dist-info → maleo_foundation-0.2.56.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.2.55.dist-info → maleo_foundation-0.2.56.dist-info}/top_level.txt +0 -0
maleo_foundation/utils/query.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from sqlalchemy import Column, Table
|
2
2
|
from sqlalchemy.ext.declarative import DeclarativeMeta
|
3
|
-
from sqlalchemy.orm import Query, Session
|
3
|
+
from sqlalchemy.orm import Query, Session, aliased
|
4
4
|
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
5
5
|
from sqlalchemy.sql.expression import or_, asc, cast, desc
|
6
6
|
from sqlalchemy.types import DATE, String, TEXT, TIMESTAMP
|
@@ -124,7 +124,9 @@ class BaseQueryUtils:
|
|
124
124
|
if parent_attr is None or not isinstance(parent_attr, InstrumentedAttribute):
|
125
125
|
return query
|
126
126
|
if is_parent is not None:
|
127
|
-
|
127
|
+
child_table = aliased(table)
|
128
|
+
child_parent_attr = getattr(child_table, parent_column)
|
129
|
+
subq = session.query(child_table).filter(child_parent_attr == id_attr).exists()
|
128
130
|
query = query.filter(subq if is_parent else ~subq)
|
129
131
|
return query
|
130
132
|
|
@@ -158,7 +160,9 @@ class BaseQueryUtils:
|
|
158
160
|
if parent_attr is None or not isinstance(parent_attr, InstrumentedAttribute):
|
159
161
|
return query
|
160
162
|
if is_leaf is not None:
|
161
|
-
|
163
|
+
child_table = aliased(table)
|
164
|
+
child_parent_attr = getattr(child_table, parent_column)
|
165
|
+
subq = session.query(child_table).filter(child_parent_attr == id_attr).exists()
|
162
166
|
query = query.filter(~subq if is_leaf else subq)
|
163
167
|
return query
|
164
168
|
|
@@ -104,7 +104,7 @@ maleo_foundation/utils/exceptions.py,sha256=kDLTWiUauvc-fSKrEyxlGvIi2NtZIAhJ9bV3
|
|
104
104
|
maleo_foundation/utils/extractor.py,sha256=SZXVYDHWGaA-Dd1BUydwF2HHdZqexEielS4CjL0Ceng,814
|
105
105
|
maleo_foundation/utils/logging.py,sha256=W5Fhk_xAXVqSujaY8mv3hRH4wlQSpUn4ReuMoiKcQa4,7759
|
106
106
|
maleo_foundation/utils/mergers.py,sha256=DniUu3Ot4qkYH_YSw4uD1cn9cfirum4S_Opp8fMkQwA,702
|
107
|
-
maleo_foundation/utils/query.py,sha256=
|
107
|
+
maleo_foundation/utils/query.py,sha256=nDj-9Q-5eAOvqXqKgKjtHaFAxVAY87E0BMaVXmTN7jA,7957
|
108
108
|
maleo_foundation/utils/repository.py,sha256=knBi3xOLlhBIEtChvqbZh4wXmgrFCB3rDwQXy41d7_c,2852
|
109
109
|
maleo_foundation/utils/dependencies/__init__.py,sha256=0KKGrdfj8Cc5A4SRk_ZBAxzOP795Mizdb4zIBh07KC4,122
|
110
110
|
maleo_foundation/utils/dependencies/auth.py,sha256=wS9qnmd1n2WsFhiSfyq_3Io3wwZKTENVPv4rMwxJslE,727
|
@@ -117,7 +117,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
117
117
|
maleo_foundation/utils/loaders/credential/google.py,sha256=SKsqPuFnAiCcYLf24CxKnMybhVHpgqnq1gGSlThqjts,994
|
118
118
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
119
119
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
120
|
-
maleo_foundation-0.2.
|
121
|
-
maleo_foundation-0.2.
|
122
|
-
maleo_foundation-0.2.
|
123
|
-
maleo_foundation-0.2.
|
120
|
+
maleo_foundation-0.2.56.dist-info/METADATA,sha256=shtv4asKRzyRFxs4n9_0tOhpQrtKWRx-wEobMeHCTnU,3598
|
121
|
+
maleo_foundation-0.2.56.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
122
|
+
maleo_foundation-0.2.56.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
123
|
+
maleo_foundation-0.2.56.dist-info/RECORD,,
|
File without changes
|
File without changes
|