querymodelling 0.0.2a0__tar.gz → 0.0.3__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.
- {querymodelling-0.0.2a0/querymodelling.egg-info → querymodelling-0.0.3}/PKG-INFO +1 -1
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/pyproject.toml +1 -1
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/__version__.py +1 -1
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/sql.py +24 -7
- {querymodelling-0.0.2a0 → querymodelling-0.0.3/querymodelling.egg-info}/PKG-INFO +1 -1
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/AUTHORS.rst +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/LICENSE +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/README.md +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/__init__.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/base.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/fields.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/model.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling/pydantic.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling.egg-info/SOURCES.txt +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling.egg-info/dependency_links.txt +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling.egg-info/requires.txt +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling.egg-info/top_level.txt +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/setup.cfg +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/setup.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/tests/__init__.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/tests/__main__.py +0 -0
- {querymodelling-0.0.2a0 → querymodelling-0.0.3}/tests/basic_test.py +0 -0
|
@@ -21,7 +21,7 @@ def sortable_by(field):
|
|
|
21
21
|
return field.asc()
|
|
22
22
|
return wrapper
|
|
23
23
|
|
|
24
|
-
def
|
|
24
|
+
def retrieve_paged_entries(
|
|
25
25
|
query: Q,
|
|
26
26
|
session: Session,
|
|
27
27
|
t: Type[T],
|
|
@@ -47,6 +47,20 @@ def retrieve_entries(
|
|
|
47
47
|
|
|
48
48
|
return total_elements, session.exec(statement).all()
|
|
49
49
|
|
|
50
|
+
def retrieve_entries(
|
|
51
|
+
query: Q,
|
|
52
|
+
session: Session,
|
|
53
|
+
t: Type[T]
|
|
54
|
+
) -> tuple[int, Sequence[T]]:
|
|
55
|
+
search_clause = get_functions(query, "query")
|
|
56
|
+
order_clause = get_functions(query, "sort")
|
|
57
|
+
statement = select(t)
|
|
58
|
+
if search_clause:
|
|
59
|
+
statement = statement.where(*search_clause)
|
|
60
|
+
if order_clause:
|
|
61
|
+
statement = statement.order_by(*order_clause)
|
|
62
|
+
return session.exec(statement).all()
|
|
63
|
+
|
|
50
64
|
def create_query_fields(
|
|
51
65
|
base_field: any,
|
|
52
66
|
field_name: str,
|
|
@@ -71,7 +85,6 @@ def create_query_fields(
|
|
|
71
85
|
validation_alias=validation_alias,
|
|
72
86
|
default=None,
|
|
73
87
|
json_schema_extra=json_schema_extra | {
|
|
74
|
-
"query.backend": "sql",
|
|
75
88
|
"query.operator": operator
|
|
76
89
|
}
|
|
77
90
|
),
|
|
@@ -98,9 +111,14 @@ def create_callback(
|
|
|
98
111
|
json_schema_extra[property_name] = field_info[
|
|
99
112
|
property_name]
|
|
100
113
|
|
|
114
|
+
json_schema_extra = json_schema_extra | {
|
|
115
|
+
"query.backend": "sql"
|
|
116
|
+
}
|
|
117
|
+
|
|
101
118
|
if annotation == str:
|
|
102
119
|
operator_mapping = {
|
|
103
120
|
None: lambda value: field == value,
|
|
121
|
+
"not": lambda value: field != value,
|
|
104
122
|
"startswith": lambda value: field.like(f"{value}%"),
|
|
105
123
|
"endswith": lambda value: field.like(f"%{value}"),
|
|
106
124
|
"contains": lambda value: field.like(f"%{value}%")
|
|
@@ -116,7 +134,8 @@ def create_callback(
|
|
|
116
134
|
operator_mapping = {
|
|
117
135
|
None: lambda value: field == value,
|
|
118
136
|
"from": lambda value: field >= value,
|
|
119
|
-
"to": lambda value: field <= value
|
|
137
|
+
"to": lambda value: field <= value,
|
|
138
|
+
"not": lambda value: field != value
|
|
120
139
|
}
|
|
121
140
|
yield from create_query_fields(
|
|
122
141
|
base_field,
|
|
@@ -124,7 +143,7 @@ def create_callback(
|
|
|
124
143
|
annotation,
|
|
125
144
|
operator_mapping,
|
|
126
145
|
json_schema_extra
|
|
127
|
-
)
|
|
146
|
+
)
|
|
128
147
|
sort_name = f"sort_{field_name}"
|
|
129
148
|
sort_name_dot = f"sort.{field_name}"
|
|
130
149
|
yield (
|
|
@@ -134,9 +153,7 @@ def create_callback(
|
|
|
134
153
|
alias=sort_name_dot,
|
|
135
154
|
validation_alias=AliasChoices(sort_name, sort_name_dot),
|
|
136
155
|
default=None,
|
|
137
|
-
json_schema_extra=json_schema_extra
|
|
138
|
-
"query.backend": "sql"
|
|
139
|
-
}
|
|
156
|
+
json_schema_extra=json_schema_extra
|
|
140
157
|
),
|
|
141
158
|
DefaultSort
|
|
142
159
|
)
|
|
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
|
{querymodelling-0.0.2a0 → querymodelling-0.0.3}/querymodelling.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|