sqlobjects 1.5.0__tar.gz → 1.6.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-1.5.0 → sqlobjects-1.6.0}/CHANGELOG.md +6 -0
- {sqlobjects-1.5.0/sqlobjects.egg-info → sqlobjects-1.6.0}/PKG-INFO +1 -1
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/pyproject.toml +1 -1
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/metadata.py +55 -2
- {sqlobjects-1.5.0 → sqlobjects-1.6.0/sqlobjects.egg-info}/PKG-INFO +1 -1
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/LICENSE +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/README.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/01-database-session-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/02-model-definition-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/03-query-operations-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/04-crud-operations-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/05-relationships-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/06-validation-signals-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/07-performance-guide.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/docs/rules/README.md +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/setup.cfg +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/_install_rules.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/cascade.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/contrib/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/contrib/asgi.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/contrib/fastapi.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/database/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/database/config.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/database/manager.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/exceptions.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/aggregate.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/base.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/cte.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/explain.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/function.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/mixins.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/scalar.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/subquery.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/terminal.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/expressions/window.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/core.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/functions.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/proxies.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/descriptors.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/managers.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/prefetch.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/strategies.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/relations/utils.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/shortcuts.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/types/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/types/base.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/types/comparators.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/types/registry.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/fields/utils.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/internal/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/internal/operations.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/internal/results.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/mixins.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/model.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/objects/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/objects/bulk.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/objects/core.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/objects/upsert.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/queries/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/queries/builder.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/queries/dialect.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/queries/executor.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/queryset.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/session.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/signals.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/utils/__init__.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/utils/inspect.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/utils/naming.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/utils/pattern.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects/validators.py +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects.egg-info/SOURCES.txt +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects.egg-info/dependency_links.txt +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects.egg-info/entry_points.txt +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects.egg-info/requires.txt +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/sqlobjects.egg-info/top_level.txt +0 -0
- {sqlobjects-1.5.0 → sqlobjects-1.6.0}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.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>
|
|
@@ -22,6 +22,7 @@ __all__ = [
|
|
|
22
22
|
"index",
|
|
23
23
|
"constraint",
|
|
24
24
|
"unique",
|
|
25
|
+
"foreignkey",
|
|
25
26
|
]
|
|
26
27
|
|
|
27
28
|
_FIELD_NAME_PATTERN = re.compile(r"\b([a-zA-Z_][a-zA-Z0-9_]*)\b")
|
|
@@ -37,7 +38,7 @@ class _RawModelConfig:
|
|
|
37
38
|
verbose_name_plural: str | None = None
|
|
38
39
|
ordering: list[str] = field(default_factory=list)
|
|
39
40
|
indexes: list[Index] = field(default_factory=list)
|
|
40
|
-
constraints: list[CheckConstraint | UniqueConstraint] = field(default_factory=list)
|
|
41
|
+
constraints: list[CheckConstraint | UniqueConstraint | ForeignKeyConstraint] = field(default_factory=list)
|
|
41
42
|
description: str | None = None
|
|
42
43
|
db_options: dict[str, dict[str, Any]] = field(default_factory=dict)
|
|
43
44
|
custom: dict[str, Any] = field(default_factory=dict)
|
|
@@ -52,7 +53,7 @@ class ModelConfig:
|
|
|
52
53
|
verbose_name_plural: str
|
|
53
54
|
ordering: list[str] = field(default_factory=list)
|
|
54
55
|
indexes: list[Index] = field(default_factory=list)
|
|
55
|
-
constraints: list[CheckConstraint | UniqueConstraint] = field(default_factory=list)
|
|
56
|
+
constraints: list[CheckConstraint | UniqueConstraint | ForeignKeyConstraint] = field(default_factory=list)
|
|
56
57
|
description: str | None = None
|
|
57
58
|
db_options: dict[str, dict[str, Any]] = field(default_factory=dict)
|
|
58
59
|
custom: dict[str, Any] = field(default_factory=dict)
|
|
@@ -1109,3 +1110,55 @@ def unique(
|
|
|
1109
1110
|
>>> unique("first_name", "last_name", name="uq_full_name")
|
|
1110
1111
|
"""
|
|
1111
1112
|
return UniqueConstraint(*fields, name=name, **kwargs)
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
def foreignkey(
|
|
1116
|
+
fields: str | list[str],
|
|
1117
|
+
references: str | list[str],
|
|
1118
|
+
*,
|
|
1119
|
+
name: str | None = None,
|
|
1120
|
+
ondelete: str | None = None,
|
|
1121
|
+
onupdate: str | None = None,
|
|
1122
|
+
deferrable: bool = False,
|
|
1123
|
+
initially: str = "IMMEDIATE",
|
|
1124
|
+
**kwargs: Any,
|
|
1125
|
+
) -> ForeignKeyConstraint:
|
|
1126
|
+
"""Create a ForeignKeyConstraint with convenient field name support.
|
|
1127
|
+
|
|
1128
|
+
Use this in Config.constraints for explicit constraint definition, custom
|
|
1129
|
+
names, or composite foreign keys. For simple single-column foreign keys,
|
|
1130
|
+
prefer the ``foreign_key()`` field descriptor instead.
|
|
1131
|
+
|
|
1132
|
+
Args:
|
|
1133
|
+
fields: Local field name(s) as string or list of strings.
|
|
1134
|
+
references: Referenced column(s) as "Table.column" or list thereof.
|
|
1135
|
+
Supports class names (e.g. "User.id") or table names (e.g. "users.id").
|
|
1136
|
+
name: Constraint name (optional, auto-generated if not provided).
|
|
1137
|
+
ondelete: Referential action on delete (CASCADE, SET NULL, RESTRICT, etc.).
|
|
1138
|
+
onupdate: Referential action on update.
|
|
1139
|
+
deferrable: Whether the constraint can be deferred.
|
|
1140
|
+
initially: Initial deferral state ("IMMEDIATE" or "DEFERRED").
|
|
1141
|
+
**kwargs: Additional SQLAlchemy ForeignKeyConstraint arguments.
|
|
1142
|
+
|
|
1143
|
+
Returns:
|
|
1144
|
+
SQLAlchemy ForeignKeyConstraint instance.
|
|
1145
|
+
|
|
1146
|
+
Examples:
|
|
1147
|
+
>>> foreignkey("author_id", "User.id")
|
|
1148
|
+
>>> foreignkey("author_id", "User.id", name="fk_posts_author", ondelete="CASCADE")
|
|
1149
|
+
>>> foreignkey(["a_id", "b_id"], ["A.id", "B.id"])
|
|
1150
|
+
"""
|
|
1151
|
+
if isinstance(fields, str):
|
|
1152
|
+
fields = [fields]
|
|
1153
|
+
if isinstance(references, str):
|
|
1154
|
+
references = [references]
|
|
1155
|
+
return ForeignKeyConstraint(
|
|
1156
|
+
fields,
|
|
1157
|
+
references,
|
|
1158
|
+
name=name,
|
|
1159
|
+
ondelete=ondelete,
|
|
1160
|
+
onupdate=onupdate,
|
|
1161
|
+
deferrable=deferrable or None,
|
|
1162
|
+
initially=initially if deferrable else None,
|
|
1163
|
+
**kwargs,
|
|
1164
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.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>
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|