oplnk-python-utils 1.1.8__tar.gz → 1.1.9__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.
- {oplnk_python_utils-1.1.8/oplnk_python_utils.egg-info → oplnk_python_utils-1.1.9}/PKG-INFO +1 -1
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/__init__.py +1 -1
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/query/query_builder.py +40 -8
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9/oplnk_python_utils.egg-info}/PKG-INFO +1 -1
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/setup.py +1 -1
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/LICENSE +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/MANIFEST.in +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/README.md +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/cache/__init__.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/cache/cache_utils.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/core/__init__.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/core/data.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/core/parsing.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/core/serialization.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/query/__init__.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/reports/__init__.py +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/SOURCES.txt +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/dependency_links.txt +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/not-zip-safe +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/requires.txt +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/top_level.txt +0 -0
- {oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/setup.cfg +0 -0
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/query/query_builder.py
RENAMED
|
@@ -1020,15 +1020,47 @@ class QueryBuilder:
|
|
|
1020
1020
|
|
|
1021
1021
|
if "filters" in query:
|
|
1022
1022
|
if not pipeline:
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1023
|
+
# Extract potential relation field names from filters, supporting
|
|
1024
|
+
# logical operators ($or/$and) and dot-notation (e.g., "company.name").
|
|
1025
|
+
def extract_relation_candidates(filters_dict):
|
|
1026
|
+
relation_names = set()
|
|
1027
|
+
|
|
1028
|
+
def walk(node):
|
|
1029
|
+
if isinstance(node, dict):
|
|
1030
|
+
for k, v in node.items():
|
|
1031
|
+
if k in ("$or", "$and"):
|
|
1032
|
+
# Value can be a list of conditions or a nested dict
|
|
1033
|
+
if isinstance(v, list):
|
|
1034
|
+
for item in v:
|
|
1035
|
+
walk(item)
|
|
1036
|
+
else:
|
|
1037
|
+
walk(v)
|
|
1038
|
+
else:
|
|
1039
|
+
# Field key: take root before dot and strip _id/_ids
|
|
1040
|
+
if (
|
|
1041
|
+
isinstance(k, str)
|
|
1042
|
+
and k
|
|
1043
|
+
and not k.startswith("$")
|
|
1044
|
+
):
|
|
1045
|
+
root = k.split(".")[0]
|
|
1046
|
+
root = re.sub(r"(_ids|_id)$", "", root)
|
|
1047
|
+
if root:
|
|
1048
|
+
relation_names.add(root)
|
|
1049
|
+
# Continue walking nested structures like
|
|
1050
|
+
# {"company": {"name": {"$containsi": "x"}}}
|
|
1051
|
+
walk(v)
|
|
1052
|
+
elif isinstance(node, list):
|
|
1053
|
+
for item in node:
|
|
1054
|
+
walk(item)
|
|
1055
|
+
# Primitives are ignored
|
|
1056
|
+
|
|
1057
|
+
walk(filters_dict)
|
|
1058
|
+
return list(relation_names)
|
|
1059
|
+
|
|
1060
|
+
relation_candidates = extract_relation_candidates(query["filters"])
|
|
1061
|
+
if relation_candidates:
|
|
1030
1062
|
populate_from_filters = self.get_count_lookup_relations(
|
|
1031
|
-
|
|
1063
|
+
relation_candidates
|
|
1032
1064
|
)
|
|
1033
1065
|
pipeline.extend(populate_from_filters)
|
|
1034
1066
|
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="oplnk-python-utils",
|
|
5
|
-
version="1.1.
|
|
5
|
+
version="1.1.9",
|
|
6
6
|
author="OpenLink SpA",
|
|
7
7
|
author_email="contacto@openlink.cl",
|
|
8
8
|
description="Reusable utilities for caching, data manipulation, parsing, and MongoDB query building",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/cache/cache_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/core/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils/reports/__init__.py
RENAMED
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{oplnk_python_utils-1.1.8 → oplnk_python_utils-1.1.9}/oplnk_python_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|