ormlambda 3.7.0__tar.gz → 3.7.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.7.0 → ormlambda-3.7.2}/PKG-INFO +1 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/pyproject.toml +2 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/caster/base_caster.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/global_checker.py +1 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/select/ISelect.py +4 -4
- ormlambda-3.7.2/src/ormlambda/components/select/__init__.py +1 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/bytes.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/datetime.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/float.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/int.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/iterable.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/none.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/string.py +3 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/update.py +1 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/join_context.py +0 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/repository/repository.py +13 -3
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/statements.py +23 -5
- ormlambda-3.7.2/src/ormlambda/databases/my_sql/types.py +73 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/base_repository.py +2 -2
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/interfaces/IRepositoryBase.py +1 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/table/table_constructor.py +2 -2
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/statements/interfaces/IStatements.py +27 -5
- ormlambda-3.7.0/src/ormlambda/components/select/__init__.py +0 -1
- {ormlambda-3.7.0 → ormlambda-3.7.2}/LICENSE +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/README.md +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/caster/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/caster/caster.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/caster/interfaces/ICaster.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/caster/interfaces/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/abstract_classes/decomposition_query.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/enums/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/enums/condition_types.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/enums/join_type.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/errors/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/ICustomAlias.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/IDecompositionQuery.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/IJoinSelector.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/common/interfaces/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/delete/IDelete.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/delete/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/delete/abstract_delete.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/insert/IInsert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/insert/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/insert/abstract_insert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/update/IUpdate.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/update/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/update/abstract_update.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/upsert/IUpsert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/upsert/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/components/upsert/abstract_upsert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/caster.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/read.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/types/point.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/caster/write.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/ST_AsText.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/ST_Contains.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/alias.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/count.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/create_database.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/delete.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/drop_database.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/drop_table.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/group_by.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/insert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/joins.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/limit.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/offset.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/order.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/select.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/upsert.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/where.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/functions/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/functions/concat.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/functions/max.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/functions/min.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/functions/sum.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/repository/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/engine/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/engine/template.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/model/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/model/base_model.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/interfaces/IDatabaseConnection.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/interfaces/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/clause_info/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/clause_info/clause_info.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/clause_info/clause_info_context.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/clause_info/interface/IAggregate.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/clause_info/interface/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/column.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/comparer.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/dtypes.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/foreign_key.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/interfaces/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/table/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/table/fields.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/sql/types.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/statements/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/statements/base_statement.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/statements/interfaces/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/statements/types.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/utils/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/utils/module_tree/__init__.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/utils/module_tree/dfs_traversal.py +0 -0
- {ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/utils/module_tree/dynamic_module.py +0 -0
@@ -3,7 +3,7 @@ line-length = 320
|
|
3
3
|
|
4
4
|
[tool.poetry]
|
5
5
|
name = "ormlambda"
|
6
|
-
version = "3.7.
|
6
|
+
version = "3.7.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"
|
@@ -19,6 +19,7 @@ python-dotenv = "^1.0.1"
|
|
19
19
|
pandas = "^2.2.2"
|
20
20
|
ruff = "^0.4.5"
|
21
21
|
parameterized = "^0.9.0"
|
22
|
+
pydantic = "^2.11.1"
|
22
23
|
|
23
24
|
|
24
25
|
[build-system]
|
@@ -14,7 +14,7 @@ class BaseCaster[TProp, TType](abc.ABC):
|
|
14
14
|
def wildcard_to_select(self, value: str) -> str: ...
|
15
15
|
@overload
|
16
16
|
def wildcard_to_select(self) -> str: ...
|
17
|
-
|
17
|
+
|
18
18
|
@abc.abstractmethod
|
19
19
|
def wildcard_to_select(self) -> str: ...
|
20
20
|
|
@@ -22,7 +22,7 @@ class BaseCaster[TProp, TType](abc.ABC):
|
|
22
22
|
def wildcard_to_where(self, value: str) -> str: ...
|
23
23
|
@overload
|
24
24
|
def wildcard_to_where(self) -> str: ...
|
25
|
-
|
25
|
+
|
26
26
|
@abc.abstractmethod
|
27
27
|
def wildcard_to_where(self) -> str: ...
|
28
28
|
|
@@ -30,7 +30,7 @@ class BaseCaster[TProp, TType](abc.ABC):
|
|
30
30
|
def wildcard_to_insert(self, value: str) -> str: ...
|
31
31
|
@overload
|
32
32
|
def wildcard_to_insert(self) -> str: ...
|
33
|
-
|
33
|
+
|
34
34
|
@abc.abstractmethod
|
35
35
|
def wildcard_to_insert(self) -> str: ...
|
36
36
|
|
@@ -23,6 +23,6 @@ class GlobalChecker:
|
|
23
23
|
except TypeError as err:
|
24
24
|
cond1 = r"takes \d+ positional argument but \d+ were given"
|
25
25
|
cond2 = r"missing \d+ required positional arguments:"
|
26
|
-
if re.search(r"("+f"{cond1}|{cond2}"+r")", err.args[0]):
|
26
|
+
if re.search(r"(" + f"{cond1}|{cond2}" + r")", err.args[0]):
|
27
27
|
raise UnmatchedLambdaParameterError(len(tables), obj)
|
28
28
|
raise err
|
@@ -6,12 +6,12 @@ from typing import TYPE_CHECKING
|
|
6
6
|
if TYPE_CHECKING:
|
7
7
|
from ormlambda.sql.clause_info import ClauseInfo
|
8
8
|
|
9
|
+
|
9
10
|
class ISelect(IQuery):
|
10
11
|
@property
|
11
12
|
@abc.abstractmethod
|
12
|
-
def FROM(self)->ClauseInfo: ...
|
13
|
-
|
13
|
+
def FROM(self) -> ClauseInfo: ...
|
14
|
+
|
14
15
|
@property
|
15
16
|
@abc.abstractmethod
|
16
|
-
def COLUMNS(self)->str: ...
|
17
|
-
|
17
|
+
def COLUMNS(self) -> str: ...
|
@@ -0,0 +1 @@
|
|
1
|
+
from .ISelect import ISelect # noqa: F401
|
@@ -6,13 +6,13 @@ class BytesCaster[TType](BaseCaster[bytes, TType]):
|
|
6
6
|
def __init__(self, value: bytes, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str = PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str = PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str = PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
@property
|
@@ -8,13 +8,13 @@ class DatetimeCaster[TType](BaseCaster[datetime, TType]):
|
|
8
8
|
def __init__(self, value: datetime, type_value: TType):
|
9
9
|
super().__init__(value, type_value)
|
10
10
|
|
11
|
-
def wildcard_to_select(self, value:str=PLACEHOLDER) -> str:
|
11
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
12
12
|
return value
|
13
13
|
|
14
|
-
def wildcard_to_where(self, value:str=PLACEHOLDER) -> str:
|
14
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
15
15
|
return value
|
16
16
|
|
17
|
-
def wildcard_to_insert(self, value:str=PLACEHOLDER) -> str:
|
17
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
18
18
|
return value
|
19
19
|
|
20
20
|
@property
|
@@ -6,13 +6,13 @@ class FloatCaster[TType](BaseCaster[float, TType]):
|
|
6
6
|
def __init__(self, value: float, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str=PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str=PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str=PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
@property
|
@@ -6,13 +6,13 @@ class IntegerCaster[TType](BaseCaster[int, TType]):
|
|
6
6
|
def __init__(self, value: int, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str=PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str=PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str=PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
@property
|
@@ -6,13 +6,13 @@ class IterableCaster[TType](BaseCaster[bytes, TType]):
|
|
6
6
|
def __init__(self, value: bytes, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str=PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str=PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str=PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
@property
|
@@ -6,13 +6,13 @@ class NoneTypeCaster[TType](BaseCaster[NoneType, TType]):
|
|
6
6
|
def __init__(self, value: NoneType, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str=PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str=PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str=PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
# TODOL: cheched if it's right
|
@@ -6,13 +6,13 @@ class StringCaster[TType](BaseCaster[str, TType]):
|
|
6
6
|
def __init__(self, value: str, type_value: TType):
|
7
7
|
super().__init__(value, type_value)
|
8
8
|
|
9
|
-
def wildcard_to_select(self, value:str = PLACEHOLDER) -> str:
|
9
|
+
def wildcard_to_select(self, value: str = PLACEHOLDER) -> str:
|
10
10
|
return value
|
11
11
|
|
12
|
-
def wildcard_to_where(self, value:str = PLACEHOLDER) -> str:
|
12
|
+
def wildcard_to_where(self, value: str = PLACEHOLDER) -> str:
|
13
13
|
return value
|
14
14
|
|
15
|
-
def wildcard_to_insert(self, value:str = PLACEHOLDER) -> str:
|
15
|
+
def wildcard_to_insert(self, value: str = PLACEHOLDER) -> str:
|
16
16
|
return value
|
17
17
|
|
18
18
|
@property
|
@@ -56,7 +56,7 @@ class UpdateQuery[T: Type[Table]](UpdateQueryBase[T, IRepositoryBase]):
|
|
56
56
|
|
57
57
|
if self.__is_valid__(col):
|
58
58
|
clean_data = CASTER.for_value(value)
|
59
|
-
col_names.append((col.column_name,clean_data.wildcard_to_insert()))
|
59
|
+
col_names.append((col.column_name, clean_data.wildcard_to_insert()))
|
60
60
|
self._values.append(clean_data.to_database)
|
61
61
|
|
62
62
|
set_query: str = ",".join(["=".join(col_data) for col_data in col_names])
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
import contextlib
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import Any, Generator, Iterable, Optional, Type, override, TYPE_CHECKING
|
4
|
+
from typing import Any, Generator, Iterable, Optional, Type, override, TYPE_CHECKING, Unpack
|
5
5
|
import shapely as shp
|
6
6
|
|
7
7
|
# from mysql.connector.pooling import MySQLConnectionPool
|
@@ -22,6 +22,7 @@ if TYPE_CHECKING:
|
|
22
22
|
from ormlambda.common.abstract_classes.decomposition_query import ClauseInfo
|
23
23
|
from ormlambda import Table
|
24
24
|
from ormlambda.databases.my_sql.clauses.select import Select
|
25
|
+
from ..types import MySQLArgs
|
25
26
|
|
26
27
|
type TResponse[TFlavour, *Ts] = TFlavour | tuple[dict[str, tuple[*Ts]]] | tuple[tuple[*Ts]] | tuple[TFlavour]
|
27
28
|
|
@@ -86,7 +87,16 @@ class Response[TFlavour, *Ts]:
|
|
86
87
|
return [list(x) for x in data]
|
87
88
|
|
88
89
|
def _default(**kwargs) -> list[TFlavour]:
|
89
|
-
|
90
|
+
replacer_dicc: dict[str, str] = {x.alias_clause: x.column for x in self._select.all_clauses}
|
91
|
+
|
92
|
+
cleaned_column_names = [replacer_dicc[col] for col in self._columns]
|
93
|
+
|
94
|
+
result = []
|
95
|
+
for attr in data:
|
96
|
+
dicc_attr = dict(zip(cleaned_column_names, attr))
|
97
|
+
result.append(self._flavour(**dicc_attr, **kwargs))
|
98
|
+
|
99
|
+
return result
|
90
100
|
|
91
101
|
selector: dict[Type[object], Any] = {
|
92
102
|
dict: _dict,
|
@@ -146,7 +156,7 @@ class MySQLRepository(BaseRepository[MySQLConnectionPool]):
|
|
146
156
|
|
147
157
|
#
|
148
158
|
|
149
|
-
def __init__(self, **kwargs):
|
159
|
+
def __init__(self, **kwargs: Unpack[MySQLArgs]):
|
150
160
|
super().__init__(MySQLConnectionPool, **kwargs)
|
151
161
|
|
152
162
|
@contextlib.contextmanager
|
@@ -354,7 +354,6 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
354
354
|
self._query_builder.by = by
|
355
355
|
self._query: str = self._query_builder.query
|
356
356
|
|
357
|
-
self._query_builder.clear()
|
358
357
|
if flavour:
|
359
358
|
result = self._return_flavour(self.query, flavour, select, **kwargs)
|
360
359
|
if issubclass(flavour, tuple) and isinstance(select_clause, Column | ClauseInfo):
|
@@ -363,10 +362,17 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
363
362
|
return self._return_model(select, self.query)
|
364
363
|
|
365
364
|
@override
|
366
|
-
def select_one[TValue, TFlavour, *Ts](
|
365
|
+
def select_one[TValue, TFlavour, *Ts](
|
366
|
+
self,
|
367
|
+
selector: Optional[tuple[TValue, *Ts]] = None,
|
368
|
+
*,
|
369
|
+
flavour: Optional[Type[TFlavour]] = None,
|
370
|
+
by: JoinType = JoinType.INNER_JOIN,
|
371
|
+
**kwargs,
|
372
|
+
):
|
367
373
|
self.limit(1)
|
368
374
|
|
369
|
-
response = self.select(selector=selector, flavour=flavour, by=by)
|
375
|
+
response = self.select(selector=selector, flavour=flavour, by=by, **kwargs)
|
370
376
|
|
371
377
|
if not isinstance(response, Iterable):
|
372
378
|
return response
|
@@ -384,8 +390,20 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
|
|
384
390
|
return tuple([res[0] for res in response])
|
385
391
|
|
386
392
|
@override
|
387
|
-
def first[TValue,
|
388
|
-
|
393
|
+
def first[TValue, TFlavour, *Ts](
|
394
|
+
self,
|
395
|
+
selector: Optional[tuple[TValue, *Ts]] = None,
|
396
|
+
*,
|
397
|
+
flavour: Optional[Type[TFlavour]] = None,
|
398
|
+
by: JoinType = JoinType.INNER_JOIN,
|
399
|
+
**kwargs,
|
400
|
+
):
|
401
|
+
return self.select_one(
|
402
|
+
selector=selector,
|
403
|
+
flavour=flavour,
|
404
|
+
by=by,
|
405
|
+
**kwargs,
|
406
|
+
)
|
389
407
|
|
390
408
|
@override
|
391
409
|
def group_by(self, column: str | Callable[[T, *Ts], Any]):
|
@@ -0,0 +1,73 @@
|
|
1
|
+
from typing import Callable, Optional, Type, TypedDict, Any
|
2
|
+
|
3
|
+
from mysql.connector.constants import (
|
4
|
+
CharacterSet,
|
5
|
+
ClientFlag,
|
6
|
+
)
|
7
|
+
from mysql.connector.types import HandShakeType, BinaryProtocolType
|
8
|
+
from mysql.connector.conversion import MySQLConverter
|
9
|
+
|
10
|
+
|
11
|
+
class MySQLArgs(TypedDict):
|
12
|
+
client_flags: ClientFlag | int
|
13
|
+
sql_mode: Optional[str]
|
14
|
+
time_zone: Optional[str]
|
15
|
+
autocommit: bool
|
16
|
+
server_version: Optional[tuple[int, ...]]
|
17
|
+
handshake: Optional[HandShakeType]
|
18
|
+
conn_attrs: dict[str, str]
|
19
|
+
|
20
|
+
user: str
|
21
|
+
password: str
|
22
|
+
password1: str
|
23
|
+
password2: str
|
24
|
+
password3: str
|
25
|
+
database: str
|
26
|
+
host: str
|
27
|
+
port: int
|
28
|
+
unix_socket: Optional[str]
|
29
|
+
client_host: str
|
30
|
+
client_port: int
|
31
|
+
ssl: dict[str, Optional[str | bool | list[str]]]
|
32
|
+
ssl_disabled: bool
|
33
|
+
force_ipv6: bool
|
34
|
+
oci_config_file: Optional[str]
|
35
|
+
oci_config_profile: Optional[str]
|
36
|
+
webauthn_callback: Optional[str | Callable[[str], None]]
|
37
|
+
krb_service_principal: Optional[str]
|
38
|
+
openid_token_file: Optional[str]
|
39
|
+
|
40
|
+
use_unicode: bool
|
41
|
+
get_warnings: bool
|
42
|
+
raise_on_warnings: bool
|
43
|
+
connection_timeout: Optional[int]
|
44
|
+
read_timeout: Optional[int]
|
45
|
+
write_timeout: Optional[int]
|
46
|
+
buffered: bool
|
47
|
+
unread_result: bool
|
48
|
+
have_next_result: bool
|
49
|
+
raw: bool
|
50
|
+
in_transaction: bool
|
51
|
+
allow_local_infile: bool
|
52
|
+
allow_local_infile_in_path: Optional[str]
|
53
|
+
|
54
|
+
prepared_statements: Any
|
55
|
+
query_attrs: dict[str, BinaryProtocolType]
|
56
|
+
|
57
|
+
ssl_active: bool
|
58
|
+
auth_plugin: Optional[str]
|
59
|
+
auth_plugin_class: Optional[str]
|
60
|
+
pool_config_version: Any
|
61
|
+
converter_class: Optional[Type[MySQLConverter]]
|
62
|
+
converter_str_fallback: bool
|
63
|
+
compress: bool
|
64
|
+
|
65
|
+
consume_results: bool
|
66
|
+
init_command: Optional[str]
|
67
|
+
character_set: CharacterSet
|
68
|
+
|
69
|
+
|
70
|
+
__all__ = [
|
71
|
+
"MySQLArgs",
|
72
|
+
"ClientFlag",
|
73
|
+
]
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import contextlib
|
2
|
-
from typing import Generator, Type
|
2
|
+
from typing import Generator, Type, Unpack
|
3
3
|
from ormlambda.repository import IRepositoryBase
|
4
4
|
import abc
|
5
5
|
|
6
6
|
|
7
7
|
class BaseRepository[TPool](IRepositoryBase):
|
8
|
-
def __init__(self, pool: Type[TPool], **kwargs:
|
8
|
+
def __init__[TArgs](self, pool: Type[TPool], **kwargs: Unpack[TArgs]) -> None:
|
9
9
|
self._data_config: dict[str, str] = kwargs
|
10
10
|
self._pool: TPool = pool(**kwargs)
|
11
11
|
|
@@ -170,8 +170,8 @@ class Table(metaclass=TableMeta):
|
|
170
170
|
return tuple([x for x in cls.__annotations__.values() if isinstance(x, Column)])
|
171
171
|
|
172
172
|
@classmethod
|
173
|
-
def get_column[TProp](cls,name:str) -> Column[TProp]:
|
174
|
-
for key,value in cls.__annotations__.items():
|
173
|
+
def get_column[TProp](cls, name: str) -> Column[TProp]:
|
174
|
+
for key, value in cls.__annotations__.items():
|
175
175
|
if name == key:
|
176
176
|
return value
|
177
177
|
|
@@ -253,19 +253,19 @@ class IStatements[T: Table](ABC):
|
|
253
253
|
@overload
|
254
254
|
def select_one(self) -> T: ...
|
255
255
|
@overload
|
256
|
-
def select_one[TFlavour](self, *, by: Optional[Enum] = ..., flavour: Type[TFlavour]) -> TFlavour: ...
|
256
|
+
def select_one[TFlavour](self, *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
257
257
|
@overload
|
258
258
|
def select_one[T1](self, selector: Callable[[T], T1 | tuple[T1]], *, by: Optional[Enum] = ...) -> T1: ...
|
259
259
|
@overload
|
260
260
|
def select_one[*TRes](self, selector: Callable[[T], tuple[*TRes]], *, by: Optional[Enum] = ...) -> tuple[*TRes]: ...
|
261
261
|
@overload
|
262
|
-
def select_one[T1](self, selector: Callable[[T], tuple[T1]], *, by: Optional[Enum] = ..., flavour: Type) -> T1: ...
|
262
|
+
def select_one[T1](self, selector: Callable[[T], tuple[T1]], *, by: Optional[Enum] = ..., flavour: Type, **kwargs) -> T1: ...
|
263
263
|
@overload
|
264
|
-
def select_one[T1, TFlavour](self, selector: Callable[[T], T1], *, by: Optional[Enum] = ..., flavour: Type[TFlavour]) ->
|
264
|
+
def select_one[T1, TFlavour](self, selector: Callable[[T], T1], *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
265
265
|
@overload
|
266
|
-
def select_one[*TRest](self, selector: Callable[[T], tuple[*TRest]], *, by: Optional[Enum] = ..., flavour: Type[tuple]) -> tuple[*TRest]: ...
|
266
|
+
def select_one[*TRest](self, selector: Callable[[T], tuple[*TRest]], *, by: Optional[Enum] = ..., flavour: Type[tuple], **kwargs) -> tuple[*TRest]: ...
|
267
267
|
@overload
|
268
|
-
def select_one[TFlavour](self, selector: Callable[[T], tuple], *, by: Optional[Enum] = ..., flavour: Type[TFlavour]) -> TFlavour: ...
|
268
|
+
def select_one[TFlavour](self, selector: Callable[[T], tuple], *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
269
269
|
@abstractmethod
|
270
270
|
def select_one[TValue, TFlavour, *TRest](
|
271
271
|
self,
|
@@ -280,6 +280,28 @@ class IStatements[T: Table](ABC):
|
|
280
280
|
# region first
|
281
281
|
@overload
|
282
282
|
def first(self) -> T: ...
|
283
|
+
@overload
|
284
|
+
def first[TFlavour](self, *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
285
|
+
@overload
|
286
|
+
def first[T1](self, selector: Callable[[T], T1 | tuple[T1]], *, by: Optional[Enum] = ...) -> T1: ...
|
287
|
+
@overload
|
288
|
+
def first[*TRes](self, selector: Callable[[T], tuple[*TRes]], *, by: Optional[Enum] = ...) -> tuple[*TRes]: ...
|
289
|
+
@overload
|
290
|
+
def first[T1](self, selector: Callable[[T], tuple[T1]], *, by: Optional[Enum] = ..., flavour: Type, **kwargs) -> T1: ...
|
291
|
+
@overload
|
292
|
+
def first[T1, TFlavour](self, selector: Callable[[T], T1], *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
293
|
+
@overload
|
294
|
+
def first[*TRest](self, selector: Callable[[T], tuple[*TRest]], *, by: Optional[Enum] = ..., flavour: Type[tuple], **kwargs) -> tuple[*TRest]: ...
|
295
|
+
@overload
|
296
|
+
def first[TFlavour](self, selector: Callable[[T], tuple], *, by: Optional[Enum] = ..., flavour: Type[TFlavour], **kwargs) -> TFlavour: ...
|
297
|
+
@abstractmethod
|
298
|
+
def first[TValue, TFlavour, *TRest](
|
299
|
+
self,
|
300
|
+
selector: Optional[Callable[[T], tuple[TValue, *TRest]]] = lambda: None,
|
301
|
+
*,
|
302
|
+
flavour: Type[TFlavour] = ...,
|
303
|
+
by: Optional[Enum] = ...,
|
304
|
+
): ...
|
283
305
|
|
284
306
|
# endregion
|
285
307
|
|
@@ -1 +0,0 @@
|
|
1
|
-
from .ISelect import ISelect # noqa: F401
|
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.7.0 → ormlambda-3.7.2}/src/ormlambda/common/abstract_classes/decomposition_query.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
|
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.7.0 → ormlambda-3.7.2}/src/ormlambda/databases/my_sql/clauses/create_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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ormlambda-3.7.0 → ormlambda-3.7.2}/src/ormlambda/repository/interfaces/IDatabaseConnection.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
|