sqlobjects 0.1.0__tar.gz → 0.2.0__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-0.1.0/sqlobjects.egg-info → sqlobjects-0.2.0}/PKG-INFO +1 -1
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/pyproject.toml +11 -3
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/database.py +1 -1
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/expressions.py +35 -2
- sqlobjects-0.2.0/sqlobjects/fields.py +2592 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/metadata.py +118 -54
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/model.py +41 -15
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/objects.py +251 -53
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/queries.py +861 -62
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/relations.py +24 -26
- {sqlobjects-0.1.0 → sqlobjects-0.2.0/sqlobjects.egg-info}/PKG-INFO +1 -1
- sqlobjects-0.1.0/sqlobjects/fields.py +0 -1866
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/LICENSE +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/setup.cfg +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/__init__.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/config.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/exceptions.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/history.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/session.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/signals.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/utils/__init__.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/utils/naming.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/utils/pattern.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects/validators.py +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects.egg-info/SOURCES.txt +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects.egg-info/dependency_links.txt +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects.egg-info/requires.txt +0 -0
- {sqlobjects-0.1.0 → sqlobjects-0.2.0}/sqlobjects.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sqlobjects"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -115,5 +115,13 @@ docstring-code-line-length = 100
|
|
|
115
115
|
asyncio_mode = "auto"
|
|
116
116
|
testpaths = ["tests"]
|
|
117
117
|
python_files = ["test_*.py", "*_test.py"]
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
addopts = [
|
|
119
|
+
"--strict-markers",
|
|
120
|
+
"-v"
|
|
121
|
+
]
|
|
122
|
+
markers = [
|
|
123
|
+
"unit: Unit tests for individual components",
|
|
124
|
+
"integration: Integration tests with real database",
|
|
125
|
+
"performance: Performance and benchmarking tests",
|
|
126
|
+
"slow: Tests that take longer than 5 seconds"
|
|
127
|
+
]
|
|
@@ -283,7 +283,7 @@ class DatabaseManager:
|
|
|
283
283
|
|
|
284
284
|
return database
|
|
285
285
|
except Exception as e:
|
|
286
|
-
raise
|
|
286
|
+
raise RuntimeError(f"Failed to connect to database '{name}': {e}") from e
|
|
287
287
|
|
|
288
288
|
def get_database(self, db_name: str | None = None) -> Database:
|
|
289
289
|
"""Get database instance
|
|
@@ -59,6 +59,8 @@ __all__ = [
|
|
|
59
59
|
"SubqueryExpression",
|
|
60
60
|
# Function mixins and expression
|
|
61
61
|
"FunctionMixin",
|
|
62
|
+
"ColumnFunctionMixin",
|
|
63
|
+
"ColumnAttributeFunctionMixin",
|
|
62
64
|
"StringFunctionMixin",
|
|
63
65
|
"NumericFunctionMixin",
|
|
64
66
|
"DateTimeFunctionMixin",
|
|
@@ -456,6 +458,34 @@ def visit_subquery_expression(element, compiler, **kw):
|
|
|
456
458
|
# === Function Mixin System ===
|
|
457
459
|
|
|
458
460
|
|
|
461
|
+
class ColumnFunctionMixin:
|
|
462
|
+
"""Function mixin for Column descriptor fields"""
|
|
463
|
+
|
|
464
|
+
def _get_expression(self):
|
|
465
|
+
"""Get expression from Column descriptor
|
|
466
|
+
|
|
467
|
+
Returns:
|
|
468
|
+
The column attribute from the descriptor
|
|
469
|
+
"""
|
|
470
|
+
# New architecture: prioritize _column_attribute
|
|
471
|
+
if hasattr(self, "_column_attribute") and self._column_attribute is not None: # type: ignore[reportAttributeAccessIssue]
|
|
472
|
+
return self._column_attribute # type: ignore[reportAttributeAccessIssue]
|
|
473
|
+
else:
|
|
474
|
+
raise AttributeError("No expression available")
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
class ColumnAttributeFunctionMixin:
|
|
478
|
+
"""Function mixin for ColumnAttribute fields"""
|
|
479
|
+
|
|
480
|
+
def _get_expression(self):
|
|
481
|
+
"""Get expression from ColumnAttribute
|
|
482
|
+
|
|
483
|
+
Returns:
|
|
484
|
+
The ColumnAttribute itself (inherits from CoreColumn)
|
|
485
|
+
"""
|
|
486
|
+
return self
|
|
487
|
+
|
|
488
|
+
|
|
459
489
|
class FunctionMixin:
|
|
460
490
|
"""Function method mixin class to reduce code duplication
|
|
461
491
|
|
|
@@ -464,12 +494,15 @@ class FunctionMixin:
|
|
|
464
494
|
"""
|
|
465
495
|
|
|
466
496
|
def _get_expression(self):
|
|
467
|
-
"""
|
|
497
|
+
"""Abstract method - subclasses must implement this method
|
|
468
498
|
|
|
469
499
|
Returns:
|
|
470
500
|
The expression object to apply functions to
|
|
501
|
+
|
|
502
|
+
Raises:
|
|
503
|
+
NotImplementedError: If subclass doesn't implement this method
|
|
471
504
|
"""
|
|
472
|
-
|
|
505
|
+
raise NotImplementedError("Subclasses must implement _get_expression()")
|
|
473
506
|
|
|
474
507
|
def _create_result(self, func_call): # noqa
|
|
475
508
|
"""Create FunctionExpression object
|