ormlambda 3.11.0__tar.gz → 3.11.2__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.
- {ormlambda-3.11.0 → ormlambda-3.11.2}/PKG-INFO +11 -7
- {ormlambda-3.11.0 → ormlambda-3.11.2}/README.md +8 -5
- {ormlambda-3.11.0 → ormlambda-3.11.2}/pyproject.toml +1 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/__init__.py +1 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/caster/caster.py +1 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/delete.py +0 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/functions/max.py +1 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/statements.py +23 -21
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/engine/__init__.py +1 -1
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/statements/interfaces/IStatements.py +21 -23
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/statements/types.py +5 -2
- ormlambda-3.11.0/src/ormlambda/databases/my_sql/caster/read.py +0 -39
- ormlambda-3.11.0/src/ormlambda/databases/my_sql/caster/write.py +0 -37
- {ormlambda-3.11.0 → ormlambda-3.11.2}/LICENSE +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/caster/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/caster/base_caster.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/caster/interfaces/ICaster.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/caster/interfaces/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/decomposition_query.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/enums/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/enums/condition_types.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/enums/join_type.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/errors/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/global_checker.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/ICustomAlias.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/IDecompositionQuery.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/IJoinSelector.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/delete/IDelete.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/delete/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/delete/abstract_delete.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/insert/IInsert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/insert/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/insert/abstract_insert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/select/ISelect.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/select/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/update/IUpdate.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/update/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/update/abstract_update.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/upsert/IUpsert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/upsert/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/components/upsert/abstract_upsert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/caster.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/bytes.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/datetime.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/float.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/int.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/iterable.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/none.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/point.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/string.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/ST_AsText.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/ST_Contains.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/alias.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/count.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/create_database.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/drop_database.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/drop_table.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/group_by.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/having.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/insert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/joins.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/limit.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/offset.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/order.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/select.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/update.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/upsert.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/where.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/functions/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/functions/concat.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/functions/min.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/functions/sum.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/join_context.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/repository/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/repository/repository.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/types.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/engine/create.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/engine/template.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/engine/url.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/engine/utils.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/model/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/model/base_model.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/base_repository.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/interfaces/IDatabaseConnection.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/interfaces/IRepositoryBase.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/interfaces/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/clause_info/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/clause_info/clause_info.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/clause_info/clause_info_context.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/clause_info/interface/IAggregate.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/clause_info/interface/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/column.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/comparer.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/dtypes.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/foreign_key.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/interfaces/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/table/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/table/fields.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/table/table_constructor.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/sql/types.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/statements/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/statements/base_statement.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/statements/interfaces/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/utils/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/utils/module_tree/__init__.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/utils/module_tree/dfs_traversal.py +0 -0
- {ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/utils/module_tree/dynamic_module.py +0 -0
@@ -1,12 +1,13 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: ormlambda
|
3
|
-
Version: 3.11.
|
3
|
+
Version: 3.11.2
|
4
4
|
Summary: ORM designed to interact with the database (currently with MySQL) using lambda functions and nested functions
|
5
5
|
Author: p-hzamora
|
6
6
|
Author-email: p.hzamora@icloud.com
|
7
7
|
Requires-Python: >=3.12,<4.0
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
10
11
|
Requires-Dist: mysql-connector-python (>=9.0.0,<10.0.0)
|
11
12
|
Requires-Dist: shapely (>=2.0.6,<3.0.0)
|
12
13
|
Description-Content-Type: text/markdown
|
@@ -69,10 +70,12 @@ Once the `AddressModel` class is created, we will not only be able to access all
|
|
69
70
|
|
70
71
|
```python
|
71
72
|
from models.address import Address
|
73
|
+
from ormlambda import create_engine, ORM
|
74
|
+
|
75
|
+
db = create_engine('mysql://root:1234@localhost:3306/sakila')
|
72
76
|
|
73
|
-
db = MySQLRepository(**config_dict)
|
74
77
|
|
75
|
-
AddressModel = ORM(Address,db)
|
78
|
+
AddressModel = ORM(Address, db)
|
76
79
|
|
77
80
|
result = AddressModel.where(Address.City.Country.country.regex(r"^[aA]")).select(
|
78
81
|
lambda address: (
|
@@ -360,10 +363,11 @@ class AddressCombine(BaseModel):
|
|
360
363
|
|
361
364
|
model_config: ConfigDict = {"extra": "forbid"}
|
362
365
|
|
363
|
-
|
364
|
-
|
366
|
+
db = create_engine('mysql://root:1234@localhost:3306/sakila')
|
367
|
+
|
365
368
|
select = (
|
366
|
-
|
369
|
+
ORM(Address, db)
|
370
|
+
.order(lambda x: x.City.Country.country, "DESC")
|
367
371
|
.limit(10)
|
368
372
|
.where(Address.City.Country.country == "Spain")
|
369
373
|
.first(
|
@@ -56,10 +56,12 @@ Once the `AddressModel` class is created, we will not only be able to access all
|
|
56
56
|
|
57
57
|
```python
|
58
58
|
from models.address import Address
|
59
|
+
from ormlambda import create_engine, ORM
|
60
|
+
|
61
|
+
db = create_engine('mysql://root:1234@localhost:3306/sakila')
|
59
62
|
|
60
|
-
db = MySQLRepository(**config_dict)
|
61
63
|
|
62
|
-
AddressModel = ORM(Address,db)
|
64
|
+
AddressModel = ORM(Address, db)
|
63
65
|
|
64
66
|
result = AddressModel.where(Address.City.Country.country.regex(r"^[aA]")).select(
|
65
67
|
lambda address: (
|
@@ -347,10 +349,11 @@ class AddressCombine(BaseModel):
|
|
347
349
|
|
348
350
|
model_config: ConfigDict = {"extra": "forbid"}
|
349
351
|
|
350
|
-
|
351
|
-
|
352
|
+
db = create_engine('mysql://root:1234@localhost:3306/sakila')
|
353
|
+
|
352
354
|
select = (
|
353
|
-
|
355
|
+
ORM(Address, db)
|
356
|
+
.order(lambda x: x.City.Country.country, "DESC")
|
354
357
|
.limit(10)
|
355
358
|
.where(Address.City.Country.country == "Spain")
|
356
359
|
.first(
|
@@ -3,7 +3,7 @@ line-length = 320
|
|
3
3
|
|
4
4
|
[tool.poetry]
|
5
5
|
name = "ormlambda"
|
6
|
-
version = "3.11.
|
6
|
+
version = "3.11.2"
|
7
7
|
description = "ORM designed to interact with the database (currently with MySQL) using lambda functions and nested functions"
|
8
8
|
authors = ["p-hzamora <p.hzamora@icloud.com>"]
|
9
9
|
readme = "README.md"
|
@@ -21,4 +21,4 @@ from .model.base_model import (
|
|
21
21
|
ORM as ORM,
|
22
22
|
) # COMMENT: to avoid relative import we need to import BaseModel after import Table,Column, ForeignKey, IRepositoryBase and Disassembler
|
23
23
|
|
24
|
-
from .engine import create_engine, URL
|
24
|
+
from .engine import create_engine, URL, make_url # noqa: F401
|
@@ -6,7 +6,6 @@ if TYPE_CHECKING:
|
|
6
6
|
from ormlambda import Table
|
7
7
|
from ormlambda.repository import IRepositoryBase
|
8
8
|
from ormlambda.components.delete import DeleteQueryBase
|
9
|
-
from mysql.connector import MySQLConnection
|
10
9
|
|
11
10
|
|
12
11
|
class DeleteQuery[T: Table](DeleteQueryBase[T, IRepositoryBase]):
|
@@ -14,7 +14,7 @@ class Max(AggregateFunctionBase[None]):
|
|
14
14
|
|
15
15
|
def __init__[TProp](
|
16
16
|
self,
|
17
|
-
elements:
|
17
|
+
elements: ColumnType[TProp],
|
18
18
|
alias_clause: AliasType[ColumnType[TProp]] = "max",
|
19
19
|
context: ClauseContextType = None,
|
20
20
|
):
|
@@ -11,9 +11,11 @@ from mysql.connector import MySQLConnection
|
|
11
11
|
|
12
12
|
|
13
13
|
if TYPE_CHECKING:
|
14
|
+
from ormlambda.sql.types import AliasType
|
14
15
|
from ormlambda import Table
|
15
16
|
from ormlambda.statements.types import OrderTypes
|
16
17
|
from ormlambda.sql.types import ColumnType
|
18
|
+
from ormlambda.statements.types import SelectCols
|
17
19
|
from ormlambda.repository.interfaces import IRepositoryBase
|
18
20
|
from ormlambda.statements.interfaces import IStatements_two_generic
|
19
21
|
from ormlambda.repository.interfaces.IRepositoryBase import TypeExists
|
@@ -289,25 +291,23 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
289
291
|
return self
|
290
292
|
|
291
293
|
@override
|
292
|
-
def count(
|
294
|
+
def count[TProp](
|
293
295
|
self,
|
294
|
-
selection: None |
|
295
|
-
|
296
|
+
selection: None | SelectCols[T,TProp] = lambda x: "*",
|
297
|
+
alias="count",
|
296
298
|
execute: bool = False,
|
297
299
|
) -> Optional[int]:
|
298
300
|
if execute is True:
|
299
|
-
return self.select_one(self.count(selection,
|
301
|
+
return self.select_one(self.count(selection, alias, False), flavour=dict)[alias]
|
300
302
|
|
301
|
-
|
302
|
-
|
303
|
-
return Count(element=selection, alias_clause=alias_clause, context=self._query_builder._context)
|
303
|
+
selection = GlobalChecker.resolved_callback_object(selection, self.models)
|
304
|
+
return Count(element=selection, alias_clause=alias, context=self._query_builder._context)
|
304
305
|
|
305
306
|
@override
|
306
307
|
def where(self, conditions: WhereTypes) -> IStatements_two_generic[T, MySQLConnection]:
|
307
308
|
# FIXME [x]: I've wrapped self._model into tuple to pass it instance attr. Idk if it's correct
|
308
309
|
|
309
|
-
|
310
|
-
conditions = GlobalChecker.resolved_callback_object(conditions, self._models)
|
310
|
+
conditions = GlobalChecker.resolved_callback_object(conditions, self._models)
|
311
311
|
if not isinstance(conditions, Iterable):
|
312
312
|
conditions = (conditions,)
|
313
313
|
self._query_builder.add_statement(Where(*conditions))
|
@@ -315,8 +315,7 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
315
315
|
|
316
316
|
@override
|
317
317
|
def having(self, conditions: WhereTypes) -> IStatements_two_generic[T, MySQLConnection]:
|
318
|
-
|
319
|
-
conditions = GlobalChecker.resolved_callback_object(conditions, self._models)
|
318
|
+
conditions = GlobalChecker.resolved_callback_object(conditions, self._models)
|
320
319
|
if not isinstance(conditions, Iterable):
|
321
320
|
conditions = (conditions,)
|
322
321
|
self._query_builder.add_statement(Having(*conditions))
|
@@ -324,13 +323,13 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
324
323
|
|
325
324
|
@override
|
326
325
|
def order[TValue](self, columns: Callable[[T], TValue], order_type: OrderTypes) -> IStatements_two_generic[T, MySQLConnection]:
|
327
|
-
query = GlobalChecker.resolved_callback_object(columns, self._models)
|
326
|
+
query = GlobalChecker.resolved_callback_object(columns, self._models)
|
328
327
|
order = Order(query, order_type)
|
329
328
|
self._query_builder.add_statement(order)
|
330
329
|
return self
|
331
330
|
|
332
331
|
@override
|
333
|
-
def concat(self, selector:
|
332
|
+
def concat(self, selector: SelectCols[T, str], alias: str = "concat") -> IAggregate:
|
334
333
|
return func.Concat[T](
|
335
334
|
values=selector,
|
336
335
|
alias_clause=alias,
|
@@ -340,10 +339,11 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
340
339
|
@override
|
341
340
|
def max[TProp](
|
342
341
|
self,
|
343
|
-
column:
|
342
|
+
column: SelectCols[T, TProp],
|
344
343
|
alias: str = "max",
|
345
344
|
execute: bool = False,
|
346
|
-
) ->
|
345
|
+
) -> int:
|
346
|
+
column = GlobalChecker.resolved_callback_object(column, self.models)
|
347
347
|
if execute is True:
|
348
348
|
return self.select_one(self.max(column, alias, execute=False), flavour=dict)[alias]
|
349
349
|
return func.Max(elements=column, alias_clause=alias, context=self._query_builder._context)
|
@@ -351,10 +351,11 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
351
351
|
@override
|
352
352
|
def min[TProp](
|
353
353
|
self,
|
354
|
-
column:
|
354
|
+
column: SelectCols[T, TProp],
|
355
355
|
alias: str = "min",
|
356
356
|
execute: bool = False,
|
357
|
-
) ->
|
357
|
+
) -> int:
|
358
|
+
column = GlobalChecker.resolved_callback_object(column, self.models)
|
358
359
|
if execute is True:
|
359
360
|
return self.select_one(self.min(column, alias, execute=False), flavour=dict)[alias]
|
360
361
|
return func.Min(elements=column, alias_clause=alias, context=self._query_builder._context)
|
@@ -362,10 +363,11 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
362
363
|
@override
|
363
364
|
def sum[TProp](
|
364
365
|
self,
|
365
|
-
column:
|
366
|
+
column: SelectCols[T, TProp],
|
366
367
|
alias: str = "sum",
|
367
368
|
execute: bool = False,
|
368
|
-
) ->
|
369
|
+
) -> int:
|
370
|
+
column = GlobalChecker.resolved_callback_object(column, self.models)
|
369
371
|
if execute is True:
|
370
372
|
return self.select_one(self.sum(column, alias, execute=False), flavour=dict)[alias]
|
371
373
|
return func.Sum(elements=column, alias_clause=alias, context=self._query_builder._context)
|
@@ -384,7 +386,7 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
384
386
|
by: JoinType = JoinType.INNER_JOIN,
|
385
387
|
**kwargs,
|
386
388
|
):
|
387
|
-
select_clause = GlobalChecker.resolved_callback_object(selector, self._models)
|
389
|
+
select_clause = GlobalChecker.resolved_callback_object(selector, self._models)
|
388
390
|
|
389
391
|
if selector is None:
|
390
392
|
# COMMENT: if we do not specify any lambda function we assumed the user want to retreive only elements of the Model itself avoiding other models
|
@@ -463,7 +465,7 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
463
465
|
return self
|
464
466
|
|
465
467
|
@override
|
466
|
-
def alias[TProp](self, column: ColumnType[TProp], alias:
|
468
|
+
def alias[TProp](self, column: ColumnType[TProp], alias: AliasType[ClauseInfo[T]]) -> ClauseInfo[T]:
|
467
469
|
return Alias(
|
468
470
|
table=column.table,
|
469
471
|
column=column,
|
@@ -1,2 +1,2 @@
|
|
1
1
|
from .create import create_engine # noqa: F401
|
2
|
-
from .url import URL # noqa: F401
|
2
|
+
from .url import URL, make_url # noqa: F401
|
@@ -4,7 +4,6 @@ from enum import Enum
|
|
4
4
|
from abc import abstractmethod, ABC
|
5
5
|
|
6
6
|
|
7
|
-
from ormlambda.common.enums import JoinType
|
8
7
|
|
9
8
|
if TYPE_CHECKING:
|
10
9
|
from ormlambda.repository import BaseRepository
|
@@ -12,6 +11,10 @@ if TYPE_CHECKING:
|
|
12
11
|
from ormlambda.sql.clause_info import IAggregate
|
13
12
|
from ormlambda.sql.types import TupleJoinType, ColumnType
|
14
13
|
from ormlambda.databases.my_sql.join_context import JoinContext
|
14
|
+
from ormlambda.common.enums import JoinType
|
15
|
+
from ormlambda.sql.clause_info import ClauseInfo
|
16
|
+
from ormlambda.sql.types import AliasType
|
17
|
+
|
15
18
|
|
16
19
|
from ..types import (
|
17
20
|
OrderTypes,
|
@@ -27,10 +30,9 @@ from ..types import (
|
|
27
30
|
Select10,
|
28
31
|
TypeExists,
|
29
32
|
WhereTypes,
|
33
|
+
SelectCols,
|
30
34
|
)
|
31
35
|
|
32
|
-
type SelectCols[T, TProp] = Callable[[T], ColumnType[TProp]] | ColumnType[TProp]
|
33
|
-
|
34
36
|
|
35
37
|
class IStatements[T: Table](ABC):
|
36
38
|
@abstractmethod
|
@@ -132,12 +134,12 @@ class IStatements[T: Table](ABC):
|
|
132
134
|
# endregion
|
133
135
|
# region count
|
134
136
|
@abstractmethod
|
135
|
-
def count(
|
137
|
+
def count[TProp](
|
136
138
|
self,
|
137
|
-
selection:
|
138
|
-
|
139
|
+
selection: None | SelectCols[T, TProp] = ...,
|
140
|
+
alias: str = ...,
|
139
141
|
execute: bool = False,
|
140
|
-
) -> Optional[
|
142
|
+
) -> Optional[int]: ...
|
141
143
|
|
142
144
|
# endregion
|
143
145
|
# region delete
|
@@ -174,45 +176,41 @@ class IStatements[T: Table](ABC):
|
|
174
176
|
|
175
177
|
# endregion
|
176
178
|
# region order
|
177
|
-
@overload
|
178
|
-
def order[TValue](self, _lambda_col: Callable[[T], TValue]) -> IStatements[T]: ...
|
179
|
-
@overload
|
180
|
-
def order[TValue](self, _lambda_col: Callable[[T], TValue], order_type: OrderTypes) -> IStatements[T]: ...
|
181
179
|
@abstractmethod
|
182
|
-
def order[TValue](self,
|
180
|
+
def order[TValue](self, columns: SelectCols[T, TValue], order_type: OrderTypes) -> IStatements[T]: ...
|
183
181
|
|
184
182
|
# endregion
|
185
183
|
# region concat
|
186
184
|
@overload
|
187
|
-
def concat(self, selector:
|
185
|
+
def concat(self, selector: SelectCols[T, str], alias: str = "concat") -> IAggregate: ...
|
188
186
|
|
189
187
|
# endregion
|
190
188
|
# region max
|
191
|
-
@
|
189
|
+
@abstractmethod
|
192
190
|
def max[TProp](
|
193
191
|
self,
|
194
192
|
column: SelectCols[T, TProp],
|
195
193
|
alias: Optional[str] = ...,
|
196
|
-
execute: bool =
|
197
|
-
) ->
|
194
|
+
execute: bool = False,
|
195
|
+
) -> int: ...
|
198
196
|
# endregion
|
199
197
|
# region min
|
200
|
-
@
|
198
|
+
@abstractmethod
|
201
199
|
def min[TProp](
|
202
200
|
self,
|
203
201
|
column: SelectCols[T, TProp],
|
204
202
|
alias: Optional[str] = ...,
|
205
|
-
execute: bool =
|
206
|
-
) ->
|
203
|
+
execute: bool = False,
|
204
|
+
) -> int: ...
|
207
205
|
# endregion
|
208
206
|
# region sum
|
209
|
-
@
|
207
|
+
@abstractmethod
|
210
208
|
def sum[TProp](
|
211
209
|
self,
|
212
210
|
column: SelectCols[T, TProp],
|
213
211
|
alias: Optional[str] = ...,
|
214
|
-
execute: bool =
|
215
|
-
) ->
|
212
|
+
execute: bool = False,
|
213
|
+
) -> int: ...
|
216
214
|
|
217
215
|
@overload
|
218
216
|
def join[FKTable](self, joins: TupleJoinType[FKTable] | tuple[*TupleJoinType[FKTable]]) -> JoinContext[tuple[*TupleJoinType[FKTable]]]: ...
|
@@ -324,7 +322,7 @@ class IStatements[T: Table](ABC):
|
|
324
322
|
# endregion
|
325
323
|
|
326
324
|
@abstractmethod
|
327
|
-
def alias(self, column:
|
325
|
+
def alias[TProp](self, column: ColumnType[TProp], alias: AliasType[ClauseInfo[T]]) -> ClauseInfo[T]: ...
|
328
326
|
|
329
327
|
|
330
328
|
class IStatements_two_generic[T, TPool](IStatements[T]):
|
@@ -10,10 +10,10 @@ from typing import (
|
|
10
10
|
import enum
|
11
11
|
|
12
12
|
|
13
|
-
from ormlambda.common.enums import JoinType
|
14
|
-
|
15
13
|
if TYPE_CHECKING:
|
14
|
+
from ormlambda.common.enums import JoinType
|
16
15
|
from ormlambda.sql.comparer import Comparer
|
16
|
+
from ormlambda.sql.types import ColumnType
|
17
17
|
|
18
18
|
type OrderTypes = Literal["ASC", "DESC"] | OrderType | Iterable[OrderType]
|
19
19
|
|
@@ -52,3 +52,6 @@ type WhereTypes[LTable, LProp, RTable, RProp] = Union[
|
|
52
52
|
tuple[Comparer[LTable, LProp, RTable, RProp], ...],
|
53
53
|
Callable[[LTable], WhereTypes[LTable, LProp, RTable, RProp]],
|
54
54
|
]
|
55
|
+
|
56
|
+
|
57
|
+
type SelectCols[T, TProp] = Callable[[T], ColumnType[TProp]] | ColumnType[TProp]
|
@@ -1,39 +0,0 @@
|
|
1
|
-
from datetime import datetime
|
2
|
-
from typing import Optional
|
3
|
-
from shapely import Point
|
4
|
-
from types import NoneType
|
5
|
-
from ormlambda.common.abstract_classes.caster.cast_base import ReadCastBase
|
6
|
-
|
7
|
-
|
8
|
-
from .types.datetime import MySQLReadDatetime
|
9
|
-
from .types.string import MySQLReadString
|
10
|
-
from .types.int import MySQLReadInt
|
11
|
-
from .types.float import MySQLReadFloat
|
12
|
-
from .types.point import MySQLReadPoint
|
13
|
-
from .types.none import MySQLReadNoneType
|
14
|
-
|
15
|
-
|
16
|
-
class MySQLReadCastBase(ReadCastBase):
|
17
|
-
@staticmethod
|
18
|
-
def cast_str(value: str) -> str:
|
19
|
-
return MySQLReadString.cast(value)
|
20
|
-
|
21
|
-
@staticmethod
|
22
|
-
def cast_int(value: str) -> int:
|
23
|
-
return MySQLReadInt.cast(value)
|
24
|
-
|
25
|
-
@staticmethod
|
26
|
-
def cast_float(value: str) -> float:
|
27
|
-
return MySQLReadFloat.cast(value)
|
28
|
-
|
29
|
-
@staticmethod
|
30
|
-
def cast_Point(value: str) -> Point:
|
31
|
-
return MySQLReadPoint.cast(value)
|
32
|
-
|
33
|
-
@staticmethod
|
34
|
-
def cast_NoneType(value: str) -> NoneType:
|
35
|
-
return MySQLReadNoneType.cast(value)
|
36
|
-
|
37
|
-
@staticmethod
|
38
|
-
def cast_datetime(value: str) -> datetime:
|
39
|
-
return MySQLReadDatetime.cast(value)
|
@@ -1,37 +0,0 @@
|
|
1
|
-
from datetime import datetime
|
2
|
-
from shapely import Point
|
3
|
-
from types import NoneType
|
4
|
-
from ormlambda.common.abstract_classes.caster.cast_base import WriteCastBase
|
5
|
-
|
6
|
-
from .types.datetime import MySQLWriteDatetime
|
7
|
-
from .types.string import MySQLWriteString
|
8
|
-
from .types.int import MySQLWriteInt
|
9
|
-
from .types.float import MySQLWriteFloat
|
10
|
-
from .types.point import MySQLWritePoint
|
11
|
-
from .types.none import MySQLWriteNoneType
|
12
|
-
|
13
|
-
|
14
|
-
class MySQLWriteCastBase(WriteCastBase):
|
15
|
-
@staticmethod
|
16
|
-
def cast_str(value: str, insert_data: bool = False) -> str:
|
17
|
-
return MySQLWriteString.cast(value, insert_data)
|
18
|
-
|
19
|
-
@staticmethod
|
20
|
-
def cast_int(value: int, insert_data: bool = False) -> str:
|
21
|
-
return MySQLWriteInt.cast(value, insert_data)
|
22
|
-
|
23
|
-
@staticmethod
|
24
|
-
def cast_float(value: float, insert_data: bool = False) -> str:
|
25
|
-
return MySQLWriteFloat.cast(value, insert_data)
|
26
|
-
|
27
|
-
@staticmethod
|
28
|
-
def cast_Point(value: Point, insert_data: bool = False) -> str:
|
29
|
-
return MySQLWritePoint.cast(value, insert_data)
|
30
|
-
|
31
|
-
@staticmethod
|
32
|
-
def cast_NoneType(value: NoneType, insert_data: bool = False) -> str:
|
33
|
-
return MySQLWriteNoneType.cast(value, insert_data)
|
34
|
-
|
35
|
-
@staticmethod
|
36
|
-
def cast_datetime(value: datetime, insert_data: bool = False) -> str:
|
37
|
-
return MySQLWriteDatetime.cast(value, insert_data)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/decomposition_query.py
RENAMED
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/abstract_classes/non_query_base.py
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
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/common/interfaces/IDecompositionQuery.py
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
|
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
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/__init__.py
RENAMED
File without changes
|
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/datetime.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/caster/types/iterable.py
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
|
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/create_database.py
RENAMED
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/clauses/drop_database.py
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
|
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
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/databases/my_sql/repository/repository.py
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
|
File without changes
|
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/interfaces/IDatabaseConnection.py
RENAMED
File without changes
|
{ormlambda-3.11.0 → ormlambda-3.11.2}/src/ormlambda/repository/interfaces/IRepositoryBase.py
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
|
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
|