ormlambda 1.1.3__py3-none-any.whl → 1.2.1__py3-none-any.whl
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/common/abstract_classes/abstract_model.py +1 -1
- ormlambda/common/interfaces/IRepositoryBase.py +4 -0
- ormlambda/common/interfaces/IStatements.py +4 -0
- ormlambda/utils/dtypes.py +14 -1
- {ormlambda-1.1.3.dist-info → ormlambda-1.2.1.dist-info}/METADATA +6 -2
- {ormlambda-1.1.3.dist-info → ormlambda-1.2.1.dist-info}/RECORD +8 -8
- {ormlambda-1.1.3.dist-info → ormlambda-1.2.1.dist-info}/LICENSE +0 -0
- {ormlambda-1.1.3.dist-info → ormlambda-1.2.1.dist-info}/WHEEL +0 -0
@@ -229,7 +229,7 @@ class AbstractSQLStatements[T: Table, TRepo](IStatements_two_generic[T, TRepo]):
|
|
229
229
|
response = self.select(selector=selector, flavour=flavour, by=by)
|
230
230
|
|
231
231
|
if flavour:
|
232
|
-
return response[0]
|
232
|
+
return response[0] if response else None
|
233
233
|
|
234
234
|
# response var could be return more than one element when we work with models an we
|
235
235
|
# select columns from different tables using a join query
|
@@ -220,6 +220,10 @@ class IStatements[T: Table](ABC):
|
|
220
220
|
@overload
|
221
221
|
def select_one[*Ts](self, selector: Callable[[T], tuple[*Ts]], *, by: Optional[Enum] = JoinType.INNER_JOIN) -> tuple[*Ts]: ...
|
222
222
|
@overload
|
223
|
+
def select_one[T1](self, selector: Callable[[T], tuple[T1]], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type) -> T1: ...
|
224
|
+
@overload
|
225
|
+
def select_one[T1, TFlavour](self, selector: Callable[[T], T1], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[TFlavour]) -> T1: ...
|
226
|
+
@overload
|
223
227
|
def select_one[*Ts](self, selector: Callable[[T], tuple[*Ts]], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[tuple]) -> tuple[*Ts]: ...
|
224
228
|
@overload
|
225
229
|
def select_one[TFlavour](self, selector: Callable[[T], tuple], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[TFlavour]) -> TFlavour: ...
|
ormlambda/utils/dtypes.py
CHANGED
@@ -66,8 +66,21 @@ DATE = Literal["DATE", "DATETIME(fsp)", "TIMESTAMP(fsp)", "TIME(fsp)", "YEAR"]
|
|
66
66
|
def transform_py_dtype_into_query_dtype(dtype: Any) -> str:
|
67
67
|
# TODOL: must be found a better way to convert python data type into SQL clauses
|
68
68
|
# float -> DECIMAL(5,2) is an error
|
69
|
-
dicc: dict[Any, str] = {
|
69
|
+
dicc: dict[Any, str] = {
|
70
|
+
int: "INTEGER",
|
71
|
+
float: "FLOAT(5,2)",
|
72
|
+
Decimal: "FLOAT",
|
73
|
+
datetime.datetime: "DATETIME",
|
74
|
+
datetime.date: "DATE",
|
75
|
+
bytes: "BLOB",
|
76
|
+
bytearray: "BLOB",
|
77
|
+
str: "VARCHAR(255)",
|
78
|
+
np.uint64: "BIGINT UNSIGNED",
|
79
|
+
}
|
70
80
|
|
81
|
+
res = dicc.get(dtype, None)
|
82
|
+
if res is None:
|
83
|
+
raise ValueError(f"datatype '{dtype}' is not expected.")
|
71
84
|
return dicc[dtype]
|
72
85
|
|
73
86
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ormlambda
|
3
|
-
Version: 1.1
|
3
|
+
Version: 1.2.1
|
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
|
@@ -8,9 +8,13 @@ Requires-Python: >=3.12,<4.0
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
10
10
|
Requires-Dist: fluent-validation (>=3.1.0,<4.0.0)
|
11
|
-
Requires-Dist: mysql-connector (>=2.2.9,<3.0.0)
|
11
|
+
Requires-Dist: mysql-connector-python (>=2.2.9,<3.0.0)
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
|
14
|
+

|
15
|
+

|
16
|
+

|
17
|
+
|
14
18
|
# ormMySQL
|
15
19
|
This ORM is designed to connect with a MySQL server, facilitating the management of various database queries. Built with flexibility and efficiency in mind, this ORM empowers developers to interact with the database using lambda functions, allowing for concise and expressive query construction.
|
16
20
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
ormlambda/__init__.py,sha256=eAkyO2ZnXFDZfquCiSGmh_kblT-WapEDd4ZnnfS0fOo,465
|
2
2
|
ormlambda/common/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
3
|
ormlambda/common/abstract_classes/__init__.py,sha256=tk2J4Mn_nD-1ZjtMVBE5FH7KR_8ppN_1Kx1s6c38GjM,167
|
4
|
-
ormlambda/common/abstract_classes/abstract_model.py,sha256=
|
4
|
+
ormlambda/common/abstract_classes/abstract_model.py,sha256=0ksGlFS2HBoN2ImNod944xBBE3xm2j91pxdHSXh7dVk,13533
|
5
5
|
ormlambda/common/abstract_classes/non_query_base.py,sha256=5jhvyT7OZaJxlGp9XMP3vQ4ei5QQZBn-fFtJnD640mE,980
|
6
6
|
ormlambda/common/abstract_classes/query_base.py,sha256=6qUFPwsVx45kUW3b66pHiSyjhcH4mzbdkddlGeUnG7c,266
|
7
7
|
ormlambda/common/enums/__init__.py,sha256=4lVKCHi1JalwgNzjsAXqX-C54NJEH83y2v5baMO8fN4,103
|
@@ -9,8 +9,8 @@ ormlambda/common/enums/condition_types.py,sha256=mDPMrtzZu4IYv3-q5Zw4NNgwUoNAx4l
|
|
9
9
|
ormlambda/common/enums/join_type.py,sha256=7LEhE34bzYOwJxe8yxPJo_EjQpGylgClAPX1Wt3z4n4,292
|
10
10
|
ormlambda/common/interfaces/INonQueryCommand.py,sha256=7CjLW4sKqkR5zUIGvhRXOtzTs6vypJW1a9EJHlgCw2c,260
|
11
11
|
ormlambda/common/interfaces/IQueryCommand.py,sha256=hfzCosK4-n8RJIb2PYs8b0qU3TNmfYluZXBf47KxxKs,331
|
12
|
-
ormlambda/common/interfaces/IRepositoryBase.py,sha256=
|
13
|
-
ormlambda/common/interfaces/IStatements.py,sha256=
|
12
|
+
ormlambda/common/interfaces/IRepositoryBase.py,sha256=ABdecwq4G_Gg4wvjpj7LWDntdjRmcMMLWOuG2pfAqfg,1939
|
13
|
+
ormlambda/common/interfaces/IStatements.py,sha256=tDQ7LviuNOCPCblSCvpnwSC5dyygWVpQ_TvxtJ2Jzp4,9628
|
14
14
|
ormlambda/common/interfaces/__init__.py,sha256=4tthR8pNIHGvgu0n7i3ZEQYP_R3wmqh40l34cAZbM2o,244
|
15
15
|
ormlambda/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
ormlambda/components/delete/IDelete.py,sha256=06ZEdbKBxsHSwsGMBu0E1om4WJjojZAm-L3b95eQrcc,139
|
@@ -52,7 +52,7 @@ ormlambda/databases/my_sql/statements.py,sha256=1umK_89JWIfViz1cHfTwqIOvMkYZT2Ii
|
|
52
52
|
ormlambda/model_base.py,sha256=jH3MTAsVF3V2jXvtKCtpAC-Q102UfBPZ0YiM0nqp-6M,1053
|
53
53
|
ormlambda/utils/__init__.py,sha256=ywMdWqmA2jHj19-W-S04yfaYF5hv4IZ1lZDq0B8Jnjs,142
|
54
54
|
ormlambda/utils/column.py,sha256=5FAGzCU4yvNS4MhwJJ5i73h7RvHD5UCVox0NdzMsMiE,1945
|
55
|
-
ormlambda/utils/dtypes.py,sha256=
|
55
|
+
ormlambda/utils/dtypes.py,sha256=1kRsT5JggNS1DMWgSUdBb67CefQHnZ-VTN1WI7nN2yQ,7879
|
56
56
|
ormlambda/utils/foreign_key.py,sha256=ewGLPtf1MrFogvwGm_jsSnOLAH2G9virXvLcc3co36I,2973
|
57
57
|
ormlambda/utils/lambda_disassembler/__init__.py,sha256=q23_F2Vp1_XgVpQSbWQPM5wxzRCZOr7ZMb9X5VG_YxU,229
|
58
58
|
ormlambda/utils/lambda_disassembler/dis_types.py,sha256=Myuo9-KSBIJSyr9jfLSDDe1jbrzyOqZNLufv6ODHm98,4824
|
@@ -65,7 +65,7 @@ ormlambda/utils/module_tree/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
65
65
|
ormlambda/utils/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkjptDbK3IugXm8iU,1425
|
66
66
|
ormlambda/utils/module_tree/dynamic_module.py,sha256=zwvjU3U2cz6H2CDp9Gncs5D5bSAyfITNa2SDqFDl8rw,8551
|
67
67
|
ormlambda/utils/table_constructor.py,sha256=I2oFTfa6BPTILY6UDYGZy4fJxZazZMkH89NObkfRemo,11480
|
68
|
-
ormlambda-1.1.
|
69
|
-
ormlambda-1.1.
|
70
|
-
ormlambda-1.1.
|
71
|
-
ormlambda-1.1.
|
68
|
+
ormlambda-1.2.1.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
|
69
|
+
ormlambda-1.2.1.dist-info/METADATA,sha256=zp0_xxUnxTWp5plXj5_ImCHX36GNXiHFobvHlRuj8wU,8427
|
70
|
+
ormlambda-1.2.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
71
|
+
ormlambda-1.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|