ormlambda 3.11.1__py3-none-any.whl → 3.11.2__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/__init__.py CHANGED
@@ -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 # noqa: F401
24
+ from .engine import create_engine, URL, make_url # noqa: F401
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
15
15
  PLACEHOLDER: str = "%s"
16
16
 
17
17
 
18
- class Caster[TRepo]:
18
+ class Caster:
19
19
  def __init__(self, repository: IRepositoryBase):
20
20
  self._repository: IRepositoryBase = repository
21
21
  self._caster = RepositoryTemplateDict().get(repository).caster
@@ -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]):
@@ -11,6 +11,7 @@ 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
@@ -464,7 +465,7 @@ class MySQLStatements[T: Table, *Ts](BaseStatement[T, MySQLConnection]):
464
465
  return self
465
466
 
466
467
  @override
467
- def alias[TProp](self, column: ColumnType[TProp], alias: str) -> ClauseInfo[T, TProp]:
468
+ def alias[TProp](self, column: ColumnType[TProp], alias: AliasType[ClauseInfo[T]]) -> ClauseInfo[T]:
468
469
  return Alias(
469
470
  table=column.table,
470
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,
@@ -319,7 +322,7 @@ class IStatements[T: Table](ABC):
319
322
  # endregion
320
323
 
321
324
  @abstractmethod
322
- def alias(self, column: Callable[[T], Any], alias: str) -> IStatements[T]: ...
325
+ def alias[TProp](self, column: ColumnType[TProp], alias: AliasType[ClauseInfo[T]]) -> ClauseInfo[T]: ...
323
326
 
324
327
 
325
328
  class IStatements_two_generic[T, TPool](IStatements[T]):
@@ -1,12 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: ormlambda
3
- Version: 3.11.1
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
- ddbb = MySQLRepository(**config_dict)
364
- model = ORM(Address, ddbb)
366
+ db = create_engine('mysql://root:1234@localhost:3306/sakila')
367
+
365
368
  select = (
366
- model.order(lambda x: x.City.Country.country, "DESC")
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(
@@ -1,7 +1,7 @@
1
- ormlambda/__init__.py,sha256=NKN-ggMFCOE4Zhir1cfFEf6c19hdPol_zWI6Fj5-h30,673
1
+ ormlambda/__init__.py,sha256=r_1UmdtPv8O7_kB9ZxpaR9JO2oWoSPcpQWoa_dlY3cU,682
2
2
  ormlambda/caster/__init__.py,sha256=JWJ6qdPTk_uyJHGfFpvFCZeOXdP6DzL4-MtMFZVDPRY,150
3
3
  ormlambda/caster/base_caster.py,sha256=c3vCGoKDyJ39kfUiS7sNKhKdjBRYSK1Ie88lwDIXqgE,1774
4
- ormlambda/caster/caster.py,sha256=ecDvGgMI3yFtJxqKD9XcSVtBcqQtYitfMTooWPlLnEY,1885
4
+ ormlambda/caster/caster.py,sha256=EiJFeb1t7wRLTloumuZYJgUt_ZNS8FEBAbLguBFLk30,1878
5
5
  ormlambda/caster/interfaces/ICaster.py,sha256=MCBBVBho9KH67vCcUk8nclY0a7QoqxgdyVJJR0-QDT0,759
6
6
  ormlambda/caster/interfaces/__init__.py,sha256=TRoIxxgxuhUhCJq2ldLS3UEa1THrMXEIyTH5K46vyGw,43
7
7
  ormlambda/common/__init__.py,sha256=g4yGxH4WEgvQ7Rix4lpp3FQ-3SeRhptNd5sabgZLQNk,59
@@ -39,7 +39,6 @@ ormlambda/databases/__init__.py,sha256=-m7uIigkbFNU5JHeOE8DeTA2bRVYEppw2XPASTSvW
39
39
  ormlambda/databases/my_sql/__init__.py,sha256=2Ue97WtcpfB6-8SgUIHLOzk_iT44YUzG6baXCHmV9uA,212
40
40
  ormlambda/databases/my_sql/caster/__init__.py,sha256=Df2sdZaAJ1Mi5Ego0sILMk5pF1NbK-nlV0hbpzd0PWE,47
41
41
  ormlambda/databases/my_sql/caster/caster.py,sha256=6byP5RJsWmnLZ2C9Br8OpdpilLedogDlTv3i8HMObu8,1217
42
- ormlambda/databases/my_sql/caster/read.py,sha256=PBseYoNJtMgmr4sL5aD6uef0f-mm6LakAz-v-IcBs7w,1096
43
42
  ormlambda/databases/my_sql/caster/types/__init__.py,sha256=lZ9YFqDjY6d6-Vy0tBMZfLI5EhyKXrb12Ys4eYiWjAg,396
44
43
  ormlambda/databases/my_sql/caster/types/bytes.py,sha256=Aq4iO-JmHeCXLqcQfNqsSTUpc1gceqY3TC4H3PJfv3g,899
45
44
  ormlambda/databases/my_sql/caster/types/datetime.py,sha256=Tw27k_svBFpmZGQDzTfi14Cl413VknOZ1t4nDXHk_dk,1062
@@ -49,14 +48,13 @@ ormlambda/databases/my_sql/caster/types/iterable.py,sha256=CVgYrQN9hIyAcFK4__e42
49
48
  ormlambda/databases/my_sql/caster/types/none.py,sha256=D2eF8sgLEywipKiJtXc_gYx3Edn5rcOUrw-DigTcprU,793
50
49
  ormlambda/databases/my_sql/caster/types/point.py,sha256=g5G691CsyQQtK6BGoKVpDzUtMRJNIKz_98xeHxqTGLE,1426
51
50
  ormlambda/databases/my_sql/caster/types/string.py,sha256=uYIfXHLrXhiShd9KRALBc2ULm7d5Y2swuz9lDX3Zucg,890
52
- ormlambda/databases/my_sql/caster/write.py,sha256=mfbtlAFamsnMbe1L4ARSAw2ch5qhz15jh5cSyAljcss,1322
53
51
  ormlambda/databases/my_sql/clauses/ST_AsText.py,sha256=Fx-CgQ01aSkcuSlcdmLIWb7f3kd7r6kWs_BGu1HOVx8,1165
54
52
  ormlambda/databases/my_sql/clauses/ST_Contains.py,sha256=K9cZwQaQQCgZTQdnAokln5lVSyV99CkeRnmOd2RIots,968
55
53
  ormlambda/databases/my_sql/clauses/__init__.py,sha256=H1DDCYiqAhrxXgovUaju5tsgLv8kU6y8Lh6vZO9uHTM,863
56
54
  ormlambda/databases/my_sql/clauses/alias.py,sha256=Xo0zQwyza3SMMRPIlBJWDQAJdW3bHjrC_UDps26P-QU,989
57
55
  ormlambda/databases/my_sql/clauses/count.py,sha256=rh7KNzpxkKEZpqmFV0oc8xHVgOHVGTGHrPGmCF-eLB4,1384
58
56
  ormlambda/databases/my_sql/clauses/create_database.py,sha256=zpd8uosxKJsf9BULvAHSd1-fU5de8OI7WRqVa8oyiA4,1209
59
- ormlambda/databases/my_sql/clauses/delete.py,sha256=Vm9lRKuX9x_m8faTlOs_A3v9zzoGGCnQ7CH_-QM6uK4,1900
57
+ ormlambda/databases/my_sql/clauses/delete.py,sha256=jJd6kIDepBJmf5f6CRxHjt-jGePG6iZXbgCDU_rQ-xk,1856
60
58
  ormlambda/databases/my_sql/clauses/drop_database.py,sha256=2GYhtWzHSWM7Yy3v_l2hiY4fFumG8DSCGGLgP0t3Rhk,437
61
59
  ormlambda/databases/my_sql/clauses/drop_table.py,sha256=ltaJJFcNXChBF7fYGNCZK9QQ4iWfG72HFacL57f2k6A,569
62
60
  ormlambda/databases/my_sql/clauses/group_by.py,sha256=m-Q6GjhjAx5Y1hH3bGmWOIvdMSE_ilEY8YNCV7fqT5g,849
@@ -78,9 +76,9 @@ ormlambda/databases/my_sql/functions/sum.py,sha256=PUItqZ4ZbBcOfPzGbYDVvhVKV1RxL
78
76
  ormlambda/databases/my_sql/join_context.py,sha256=SLxVSwCURLOBSMB-aN7PV69sBQXOOP1sCezAKn3Wnqo,3256
79
77
  ormlambda/databases/my_sql/repository/__init__.py,sha256=_T7m-UpgJlx7eYdjBw8jdSVFGnjFYAcbp45g4EM7YEk,54
80
78
  ormlambda/databases/my_sql/repository/repository.py,sha256=DXxY1I4NMA7zshWpzSc6TKf3RlNsOfdk_DDjCF7PoxQ,12149
81
- ormlambda/databases/my_sql/statements.py,sha256=9mqKSVsgceRc666aG56CoJsUu5zI5LAg0CWmeRQK928,17280
79
+ ormlambda/databases/my_sql/statements.py,sha256=iGfXBiaNAo2LqqBfU6zfcwB49by-vPUxklhgkIoHZHU,17340
82
80
  ormlambda/databases/my_sql/types.py,sha256=6c7LMS1VGR8ko1LB1T8DQzn1l10Mzk8PfIeYEOb9w30,1839
83
- ormlambda/engine/__init__.py,sha256=tTA0VcN-kxpmnTS0smq7IK0ohGVwpM5TIju-sDnZhfk,82
81
+ ormlambda/engine/__init__.py,sha256=Nubog0bQrWZHPsl7g-l3nlFN8be_aHMrQEYfE2RVme8,93
84
82
  ormlambda/engine/create.py,sha256=HwtLi9T_Z7mnZIPfSmutRPT7SlIDFfs82oJuVe-pObo,955
85
83
  ormlambda/engine/template.py,sha256=colmdl-IBSGc1eIqIYShsVkseQwF5_gwwc6Pt8ndN24,1350
86
84
  ormlambda/engine/url.py,sha256=4FnkQQO93jQcGWmZF38DiJgIrRcIgIYacy2N6Dy3YX8,25401
@@ -109,14 +107,14 @@ ormlambda/sql/table/table_constructor.py,sha256=_sc1WnhnjchvIzxQZ85qZJFGZExlmhgK
109
107
  ormlambda/sql/types.py,sha256=z5FME0m9j7zSKlxS21cZxHRg0pyTfiJbq7VWZ6IT0kM,832
110
108
  ormlambda/statements/__init__.py,sha256=mFER-VoLf5L2BjdQhWMw6rVQi8kpr-qZzi1ZSWRPIIU,99
111
109
  ormlambda/statements/base_statement.py,sha256=WLjQrWw72NhBdNkP8uO1UP8hzfv-leyFjmMa4ofa-fk,5660
112
- ormlambda/statements/interfaces/IStatements.py,sha256=GhaC7KpQJT1i0vAZjreIN91H6PiNWvhmDt77ZWHxdW4,11731
110
+ ormlambda/statements/interfaces/IStatements.py,sha256=83G7KemLYWTTQqvDCm3GnXBhr00bli-28YpiAbyt1yU,11861
113
111
  ormlambda/statements/interfaces/__init__.py,sha256=a3RyTNVA7DwWMqvVi7gFYP4MArdU-RUYixJcxfc79HY,76
114
112
  ormlambda/statements/types.py,sha256=0AYnj6WCQcS-4fhsaK_yu2zQR3guPhPluq_sZxH1UhQ,1938
115
113
  ormlambda/utils/__init__.py,sha256=SEgDWkwbSrYRv0If92Ewq53DKnxxv5HqEAQbETd1C6Q,50
116
114
  ormlambda/utils/module_tree/__init__.py,sha256=LNQtqkwO1ul49Th3aHAIiyt0Wt899GmXCc44Uz1eDyY,53
117
115
  ormlambda/utils/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkjptDbK3IugXm8iU,1425
118
116
  ormlambda/utils/module_tree/dynamic_module.py,sha256=SJWpOC5oqASGjCXYHW0JwzEpcZ_DkxKLyK4SpIsMbaA,8700
119
- ormlambda-3.11.1.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
120
- ormlambda-3.11.1.dist-info/METADATA,sha256=heOegmWNeP8I61l3pjhm6Gchi494A0CTTGoX6HPtgnc,12450
121
- ormlambda-3.11.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
122
- ormlambda-3.11.1.dist-info/RECORD,,
117
+ ormlambda-3.11.2.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
118
+ ormlambda-3.11.2.dist-info/METADATA,sha256=YEWvidWeBafsYuVZLKrBY8IcsnhkbzYbZewgiI567Eo,12584
119
+ ormlambda-3.11.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
120
+ ormlambda-3.11.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -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)