sqlobjects 1.2.4__tar.gz → 1.2.5__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.
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/CHANGELOG.md +7 -0
- {sqlobjects-1.2.4/sqlobjects.egg-info → sqlobjects-1.2.5}/PKG-INFO +1 -1
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/pyproject.toml +1 -1
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/function.py +2 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/mixins.py +19 -3
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/types/comparators.py +54 -5
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/types/registry.py +6 -4
- {sqlobjects-1.2.4 → sqlobjects-1.2.5/sqlobjects.egg-info}/PKG-INFO +1 -1
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/LICENSE +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/README.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/01-database-session-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/02-model-definition-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/03-query-operations-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/04-crud-operations-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/05-relationships-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/06-validation-signals-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/07-performance-guide.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/docs/rules/README.md +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/setup.cfg +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/_install_rules.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/cascade.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/database/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/database/config.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/database/manager.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/exceptions.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/aggregate.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/base.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/cte.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/explain.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/scalar.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/subquery.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/terminal.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/expressions/window.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/core.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/functions.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/proxies.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/descriptors.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/managers.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/prefetch.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/strategies.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/relations/utils.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/shortcuts.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/types/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/types/base.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/fields/utils.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/internal/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/internal/operations.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/internal/results.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/metadata.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/mixins.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/model.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/objects/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/objects/bulk.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/objects/core.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/objects/upsert.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/queries/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/queries/builder.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/queries/dialect.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/queries/executor.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/queryset.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/session.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/signals.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/utils/__init__.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/utils/inspect.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/utils/naming.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/utils/pattern.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects/validators.py +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects.egg-info/SOURCES.txt +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects.egg-info/dependency_links.txt +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects.egg-info/entry_points.txt +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects.egg-info/requires.txt +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/sqlobjects.egg-info/top_level.txt +0 -0
- {sqlobjects-1.2.4 → sqlobjects-1.2.5}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -147,6 +147,8 @@ class FunctionExpression:
|
|
|
147
147
|
for building complex database expressions.
|
|
148
148
|
"""
|
|
149
149
|
|
|
150
|
+
is_clause_element = False # prevent __getattr__ from proxying this to expression.is_clause_element
|
|
151
|
+
|
|
150
152
|
if TYPE_CHECKING:
|
|
151
153
|
# Inherit all method hints for IDE support
|
|
152
154
|
def __new__(cls, *args, **kwargs) -> "FunctionExpression & _FunctionMethods": ... # type: ignore
|
|
@@ -247,9 +247,25 @@ class ColumnAttributeFunctionMixin(FunctionMixin):
|
|
|
247
247
|
def extract(self, field: str) -> "FunctionExpression": ...
|
|
248
248
|
def date_trunc(self, precision: str) -> "FunctionExpression": ...
|
|
249
249
|
|
|
250
|
-
# JSON methods
|
|
251
|
-
def
|
|
252
|
-
def
|
|
250
|
+
# JSON methods (MySQL json type)
|
|
251
|
+
def json_extract(self, path: str) -> "FunctionExpression": ...
|
|
252
|
+
def json_unquote(self, path: str) -> "FunctionExpression": ...
|
|
253
|
+
def json_contains(self, other, path: str | None = None) -> "FunctionExpression": ...
|
|
254
|
+
def json_contains_path(self, *paths: str, match: str = "one") -> "FunctionExpression": ...
|
|
255
|
+
def json_length(self, path: str | None = None) -> "FunctionExpression": ...
|
|
256
|
+
def json_keys(self, path: str | None = None) -> "FunctionExpression": ...
|
|
257
|
+
def json_overlaps(self, other) -> "FunctionExpression": ...
|
|
258
|
+
def json_search(self, value: str, match: str = "one", path: str | None = None) -> "FunctionExpression": ...
|
|
259
|
+
def json_type(self) -> "FunctionExpression": ...
|
|
260
|
+
|
|
261
|
+
# JSONB methods (PostgreSQL jsonb type)
|
|
262
|
+
def contained_by(self, other) -> "FunctionExpression": ...
|
|
263
|
+
def has_key(self, other) -> "FunctionExpression": ...
|
|
264
|
+
def has_all(self, other) -> "FunctionExpression": ...
|
|
265
|
+
def has_any(self, other) -> "FunctionExpression": ...
|
|
266
|
+
def path_exists(self, other) -> "FunctionExpression": ...
|
|
267
|
+
def path_match(self, other) -> "FunctionExpression": ...
|
|
268
|
+
def delete_path(self, array) -> "FunctionExpression": ...
|
|
253
269
|
|
|
254
270
|
# Common methods (all types)
|
|
255
271
|
def sum(self) -> "FunctionExpression": ...
|
|
@@ -323,13 +323,62 @@ class DateTimeComparator(ComparatorMixin, DateTime.Comparator): # type: ignore[
|
|
|
323
323
|
|
|
324
324
|
|
|
325
325
|
class JSONComparator(ComparatorMixin, JSON.Comparator): # type: ignore[reportIncompatibleMethodOverride]
|
|
326
|
-
"""JSON type comparator
|
|
326
|
+
"""MySQL JSON type comparator. For PostgreSQL, use jsonb type instead."""
|
|
327
327
|
|
|
328
|
-
def
|
|
329
|
-
|
|
328
|
+
def json_extract(self, path: str) -> FunctionExpression:
|
|
329
|
+
"""JSON_EXTRACT(col, path) - e.g. json_extract('$.name')"""
|
|
330
|
+
return FunctionExpression(func.json_extract(self, path))
|
|
330
331
|
|
|
331
|
-
def
|
|
332
|
-
|
|
332
|
+
def json_unquote(self, path: str) -> FunctionExpression:
|
|
333
|
+
"""JSON_UNQUOTE(JSON_EXTRACT(col, path)) - returns unquoted string value"""
|
|
334
|
+
return FunctionExpression(func.json_unquote(func.json_extract(self, path)))
|
|
335
|
+
|
|
336
|
+
def json_contains(self, other, path: str | None = None) -> FunctionExpression:
|
|
337
|
+
"""JSON_CONTAINS(col, val[, path]) - check if JSON contains value"""
|
|
338
|
+
import json
|
|
339
|
+
|
|
340
|
+
from sqlalchemy import literal
|
|
341
|
+
|
|
342
|
+
value = [other] if not isinstance(other, (list, dict)) else other
|
|
343
|
+
json_val = literal(json.dumps(value))
|
|
344
|
+
if path is not None:
|
|
345
|
+
return FunctionExpression(func.json_contains(self, json_val, path))
|
|
346
|
+
return FunctionExpression(func.json_contains(self, json_val))
|
|
347
|
+
|
|
348
|
+
def json_contains_path(self, *paths: str, match: str = "one") -> FunctionExpression:
|
|
349
|
+
"""JSON_CONTAINS_PATH(col, 'one'|'all', path, ...) - check if path(s) exist"""
|
|
350
|
+
return FunctionExpression(func.json_contains_path(self, match, *paths))
|
|
351
|
+
|
|
352
|
+
def json_length(self, path: str | None = None) -> FunctionExpression:
|
|
353
|
+
"""JSON_LENGTH(col[, path]) - array/object length"""
|
|
354
|
+
if path is not None:
|
|
355
|
+
return FunctionExpression(func.json_length(self, path))
|
|
356
|
+
return FunctionExpression(func.json_length(self))
|
|
357
|
+
|
|
358
|
+
def json_keys(self, path: str | None = None) -> FunctionExpression:
|
|
359
|
+
"""JSON_KEYS(col[, path]) - return all keys as JSON array"""
|
|
360
|
+
if path is not None:
|
|
361
|
+
return FunctionExpression(func.json_keys(self, path))
|
|
362
|
+
return FunctionExpression(func.json_keys(self))
|
|
363
|
+
|
|
364
|
+
def json_overlaps(self, other) -> FunctionExpression:
|
|
365
|
+
"""JSON_OVERLAPS(col, val) - check if two JSON documents share any key-value pairs (MySQL 8.0+)"""
|
|
366
|
+
import json
|
|
367
|
+
|
|
368
|
+
from sqlalchemy import literal
|
|
369
|
+
|
|
370
|
+
value = other if isinstance(other, str) else json.dumps(other)
|
|
371
|
+
return FunctionExpression(func.json_overlaps(self, literal(value)))
|
|
372
|
+
|
|
373
|
+
def json_search(self, value: str, match: str = "one", path: str | None = None) -> FunctionExpression:
|
|
374
|
+
"""JSON_SEARCH(col, 'one'|'all', val[, path]) - find path of value"""
|
|
375
|
+
if path is not None:
|
|
376
|
+
return FunctionExpression(func.json_search(self, match, value, None, path))
|
|
377
|
+
return FunctionExpression(func.json_search(self, match, value))
|
|
378
|
+
|
|
379
|
+
def json_type(self) -> FunctionExpression:
|
|
380
|
+
"""JSON_TYPE(col) - return JSON value type as string"""
|
|
381
|
+
return FunctionExpression(func.json_type(self))
|
|
333
382
|
|
|
334
383
|
|
|
335
384
|
class BooleanComparator(ComparatorMixin, Boolean.Comparator): # type: ignore[reportIncompatibleMethodOverride]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
from typing import Any, Callable, NotRequired, TypedDict
|
|
3
3
|
|
|
4
|
+
from sqlalchemy.dialects.mysql import JSON
|
|
5
|
+
from sqlalchemy.dialects.postgresql import JSONB
|
|
4
6
|
from sqlalchemy.sql.sqltypes import (
|
|
5
7
|
ARRAY,
|
|
6
|
-
JSON,
|
|
7
8
|
BigInteger,
|
|
8
9
|
Boolean,
|
|
9
10
|
Date,
|
|
@@ -344,14 +345,15 @@ class TypeRegistry:
|
|
|
344
345
|
(Interval, "interval", DateTimeComparator, [], {}),
|
|
345
346
|
(LargeBinary, "binary", DefaultComparator, ["bytes"], {}),
|
|
346
347
|
(Uuid, "uuid", StringComparator, [], {}),
|
|
347
|
-
(JSON, "json", JSONComparator, ["dict"], {}),
|
|
348
348
|
]
|
|
349
349
|
|
|
350
|
-
# Special types
|
|
350
|
+
# Special types: dialect-specific or non-standard types
|
|
351
351
|
special_types = [
|
|
352
|
-
(ARRAY, "array", DefaultComparator, [], {}),
|
|
352
|
+
(ARRAY, "array", DefaultComparator, [], {}), # PostgreSQL only
|
|
353
353
|
(Enum, "enum", DefaultComparator, [], {}),
|
|
354
354
|
(Auto, "auto", DefaultComparator, [], {}),
|
|
355
|
+
(JSON, "json", JSONComparator, ["dict"], {}), # MySQL: contains -> JSON_CONTAINS
|
|
356
|
+
(JSONB, "jsonb", JSONB.Comparator, [], {}), # PostgreSQL: contains -> @>
|
|
355
357
|
]
|
|
356
358
|
|
|
357
359
|
for field_type, name, comparator, aliases, defaults in builtin_types + special_types:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|