TypeDAL 3.10.5__tar.gz → 3.11.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.
Potentially problematic release.
This version of TypeDAL might be problematic. Click here for more details.
- {typedal-3.10.5 → typedal-3.11.0}/CHANGELOG.md +7 -0
- {typedal-3.10.5 → typedal-3.11.0}/PKG-INFO +2 -2
- typedal-3.11.0/coverage.svg +1 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/__about__.py +1 -1
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/core.py +37 -6
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_query_builder.py +3 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_table.py +1 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/timings.py +1 -0
- typedal-3.10.5/coverage.svg +0 -1
- {typedal-3.10.5 → typedal-3.11.0}/.github/workflows/su6.yml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/.gitignore +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/.readthedocs.yml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/README.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/1_getting_started.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/2_defining_tables.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/3_building_queries.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/4_relationships.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/5_py4web.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/6_migrations.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/7_mixins.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/css/code_blocks.css +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/index.md +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/docs/requirements.txt +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/example_new.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/example_old.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/mkdocs.yml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/pyproject.toml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/__init__.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/caching.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/cli.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/config.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/fields.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/for_py4web.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/for_web2py.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/helpers.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/mixins.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/py.typed +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/serializers/as_json.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/types.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/src/typedal/web2py_py4web_shared.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/__init__.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/configs/simple.toml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/configs/valid.env +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/configs/valid.toml +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_cli.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_config.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_docs_examples.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_helpers.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_json.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_main.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_mixins.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_mypy.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_orm.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_py4web.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_relationships.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_row.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_stats.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_web2py.py +0 -0
- {typedal-3.10.5 → typedal-3.11.0}/tests/test_xx_others.py +0 -0
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
<!--next-version-placeholder-->
|
|
4
4
|
|
|
5
|
+
## v3.11.0 (2025-04-25)
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
* Add `._count()` to get sql for `.count()` ([`6a336e9`](https://github.com/trialandsuccess/TypeDAL/commit/6a336e903017a2fcfac9bea313f150e5af8d77de))
|
|
10
|
+
* Add `.exists()` method on querybuilder to check if there are any rows (using `.count()`) ([`7e54e64`](https://github.com/trialandsuccess/TypeDAL/commit/7e54e64461e04f6e65a9aa4d1736585f088bc9d1))
|
|
11
|
+
|
|
5
12
|
## v3.10.5 (2025-04-22)
|
|
6
13
|
|
|
7
14
|
### Fix
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: TypeDAL
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.0
|
|
4
4
|
Summary: Typing support for PyDAL
|
|
5
5
|
Project-URL: Documentation, https://typedal.readthedocs.io/
|
|
6
6
|
Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="122" height="20" role="img" aria-label="coverage: 100.00%"><title>coverage: 100.00%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="61" height="20" fill="#4c1"/><rect width="122" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">100.00%</text><text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="510">100.00%</text></g></svg>
|
|
@@ -1041,6 +1041,12 @@ class TableMeta(type):
|
|
|
1041
1041
|
"""
|
|
1042
1042
|
return QueryBuilder(self).count()
|
|
1043
1043
|
|
|
1044
|
+
def exists(self: Type[T_MetaInstance]) -> bool:
|
|
1045
|
+
"""
|
|
1046
|
+
See QueryBuilder.exists!
|
|
1047
|
+
"""
|
|
1048
|
+
return QueryBuilder(self).exists()
|
|
1049
|
+
|
|
1044
1050
|
def first(self: Type[T_MetaInstance]) -> T_MetaInstance | None:
|
|
1045
1051
|
"""
|
|
1046
1052
|
See QueryBuilder.first!
|
|
@@ -2788,14 +2794,10 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
|
|
|
2788
2794
|
"""
|
|
2789
2795
|
yield from self.collect()
|
|
2790
2796
|
|
|
2791
|
-
def
|
|
2792
|
-
|
|
2793
|
-
Return the amount of rows matching the current query.
|
|
2794
|
-
"""
|
|
2795
|
-
db = self._get_db()
|
|
2797
|
+
def __count(self, db: TypeDAL, distinct: bool = None):
|
|
2798
|
+
# internal, shared logic between .count and ._count
|
|
2796
2799
|
model = self.model
|
|
2797
2800
|
query = self.query
|
|
2798
|
-
|
|
2799
2801
|
for key, relation in self.relationships.items():
|
|
2800
2802
|
if (not relation.condition or relation.join != "inner") and not distinct:
|
|
2801
2803
|
continue
|
|
@@ -2806,8 +2808,37 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
|
|
|
2806
2808
|
other = other.with_alias(f"{key}_{hash(relation)}")
|
|
2807
2809
|
query &= relation.condition(model, other)
|
|
2808
2810
|
|
|
2811
|
+
return query
|
|
2812
|
+
|
|
2813
|
+
def count(self, distinct: bool = None) -> int:
|
|
2814
|
+
"""
|
|
2815
|
+
Return the amount of rows matching the current query.
|
|
2816
|
+
"""
|
|
2817
|
+
db = self._get_db()
|
|
2818
|
+
query = self.__count(db, distinct=distinct)
|
|
2819
|
+
|
|
2809
2820
|
return db(query).count(distinct)
|
|
2810
2821
|
|
|
2822
|
+
def _count(self, distinct: bool = None):
|
|
2823
|
+
"""
|
|
2824
|
+
Return the SQL for .count().
|
|
2825
|
+
"""
|
|
2826
|
+
db = self._get_db()
|
|
2827
|
+
query = self.__count(db, distinct=distinct)
|
|
2828
|
+
|
|
2829
|
+
return db(query)._count(distinct)
|
|
2830
|
+
|
|
2831
|
+
def exists(self) -> bool:
|
|
2832
|
+
"""
|
|
2833
|
+
Determines if any records exist matching the current query.
|
|
2834
|
+
|
|
2835
|
+
Returns True if one or more records exist; otherwise, False.
|
|
2836
|
+
|
|
2837
|
+
Returns:
|
|
2838
|
+
bool: A boolean indicating whether any records exist.
|
|
2839
|
+
"""
|
|
2840
|
+
return bool(self.count())
|
|
2841
|
+
|
|
2811
2842
|
def __paginate(
|
|
2812
2843
|
self,
|
|
2813
2844
|
limit: int,
|
typedal-3.10.5/coverage.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="20" role="img" aria-label="coverage: 100.00%"><title>coverage: 100.00%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="61" height="20" fill="#4c1"/><rect width="122" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">100.00%</text><text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="510">100.00%</text></g></svg>
|
|
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
|