ormlambda 4.0.4__py3-none-any.whl → 4.0.5__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/dialects/__init__.py +11 -4
- ormlambda/dialects/default/base.py +3 -2
- ormlambda/dialects/mysql/base.py +4 -1
- ormlambda/engine/base.py +15 -2
- ormlambda/engine/create.py +6 -1
- ormlambda/repository/base_repository.py +4 -0
- {ormlambda-4.0.4.dist-info → ormlambda-4.0.5.dist-info}/METADATA +3 -2
- {ormlambda-4.0.4.dist-info → ormlambda-4.0.5.dist-info}/RECORD +11 -11
- {ormlambda-4.0.4.dist-info → ormlambda-4.0.5.dist-info}/WHEEL +1 -1
- {ormlambda-4.0.4.dist-info → ormlambda-4.0.5.dist-info}/AUTHORS +0 -0
- {ormlambda-4.0.4.dist-info → ormlambda-4.0.5.dist-info}/LICENSE +0 -0
ormlambda/dialects/__init__.py
CHANGED
@@ -3,13 +3,14 @@ from typing import Callable, Optional, Type, TYPE_CHECKING, ClassVar
|
|
3
3
|
import abc
|
4
4
|
from ormlambda import util
|
5
5
|
import importlib
|
6
|
+
from ormlambda import BaseRepository
|
6
7
|
|
7
8
|
|
8
9
|
if TYPE_CHECKING:
|
10
|
+
from ormlambda import URL
|
9
11
|
from ormlambda.caster.caster import Caster
|
10
12
|
from ormlambda.repository.interfaces.IRepositoryBase import DBAPIConnection
|
11
13
|
from ormlambda.sql.types import DDLCompiler, SQLCompiler, TypeCompiler
|
12
|
-
from ormlambda import BaseRepository
|
13
14
|
|
14
15
|
|
15
16
|
class Dialect(abc.ABC):
|
@@ -57,15 +58,21 @@ class Dialect(abc.ABC):
|
|
57
58
|
type_compiler_instance: ClassVar[TypeCompiler]
|
58
59
|
"""The instance of the type compiler class used by the dialect."""
|
59
60
|
|
60
|
-
repository_cls: ClassVar[Type[BaseRepository]]
|
61
|
-
"""The repository class used by the dialect."""
|
62
|
-
|
63
61
|
caster: ClassVar[Type[Caster]]
|
64
62
|
|
65
63
|
@classmethod
|
66
64
|
def get_dialect_cls(cls) -> Type[Dialect]:
|
67
65
|
return cls
|
68
66
|
|
67
|
+
@classmethod
|
68
|
+
@abc.abstractmethod
|
69
|
+
def get_pool_class(cls, url: URL) -> Type[BaseRepository]: ...
|
70
|
+
|
71
|
+
@abc.abstractmethod
|
72
|
+
def get_dialect_pool_class(self, url: str) -> None:
|
73
|
+
"""Validates an identifier name, raising an exception if invalid"""
|
74
|
+
...
|
75
|
+
|
69
76
|
@classmethod
|
70
77
|
@abc.abstractmethod
|
71
78
|
def import_dbapi(cls) -> DBAPIConnection:
|
@@ -2,7 +2,6 @@ from ormlambda.dialects import Dialect
|
|
2
2
|
from ormlambda.sql import compiler
|
3
3
|
from typing import Optional, Any
|
4
4
|
from types import ModuleType
|
5
|
-
from ormlambda import BaseRepository
|
6
5
|
|
7
6
|
|
8
7
|
class DefaultDialect(Dialect):
|
@@ -11,7 +10,6 @@ class DefaultDialect(Dialect):
|
|
11
10
|
statement_compiler = compiler.SQLCompiler
|
12
11
|
ddl_compiler = compiler.DDLCompiler
|
13
12
|
type_compiler_cls = compiler.GenericTypeCompiler
|
14
|
-
repository_cls = BaseRepository
|
15
13
|
default_paramstyle = "named"
|
16
14
|
|
17
15
|
def __init__(
|
@@ -37,3 +35,6 @@ class DefaultDialect(Dialect):
|
|
37
35
|
self.type_compiler_instance = self.type_compiler = tt_callable(self)
|
38
36
|
|
39
37
|
super().__init__(**kwargs)
|
38
|
+
|
39
|
+
def get_dialect_pool_class(self, url):
|
40
|
+
return self.get_pool_class(url)
|
ormlambda/dialects/mysql/base.py
CHANGED
@@ -627,7 +627,6 @@ class MySQLDialect(default.DefaultDialect):
|
|
627
627
|
statement_compiler = MySQLCompiler
|
628
628
|
ddl_compiler = MySQLDDLCompiler
|
629
629
|
type_compiler_cls = MySQLTypeCompiler
|
630
|
-
repository_cls = MySQLRepository
|
631
630
|
caster = MySQLCaster
|
632
631
|
|
633
632
|
def __init__(self, **kwargs):
|
@@ -638,3 +637,7 @@ class MySQLDialect(default.DefaultDialect):
|
|
638
637
|
from mysql import connector
|
639
638
|
|
640
639
|
return connector
|
640
|
+
|
641
|
+
@classmethod
|
642
|
+
def get_pool_class(cls, url):
|
643
|
+
return MySQLRepository
|
ormlambda/engine/base.py
CHANGED
@@ -3,6 +3,7 @@ from pathlib import Path
|
|
3
3
|
from typing import TYPE_CHECKING, BinaryIO, Literal, Optional, TextIO
|
4
4
|
from ormlambda.engine import url
|
5
5
|
from ormlambda.sql.ddl import CreateSchema, DropSchema, CreateBackup
|
6
|
+
from ormlambda import BaseRepository
|
6
7
|
|
7
8
|
if TYPE_CHECKING:
|
8
9
|
from ormlambda.dialects import Dialect
|
@@ -11,10 +12,10 @@ type TypeExists = Literal["fail", "replace", "append"]
|
|
11
12
|
|
12
13
|
|
13
14
|
class Engine:
|
14
|
-
def __init__(self, dialect: Dialect, url: url.URL):
|
15
|
+
def __init__(self, repository: BaseRepository, dialect: Dialect, url: url.URL):
|
16
|
+
self.repository = repository
|
15
17
|
self.dialect = dialect
|
16
18
|
self.url = url
|
17
|
-
self.repository = self.dialect.repository_cls(url, dialect=dialect)
|
18
19
|
|
19
20
|
def __repr__(self):
|
20
21
|
return f"{Engine.__name__}: {self.url}"
|
@@ -78,3 +79,15 @@ class Engine:
|
|
78
79
|
)
|
79
80
|
.string
|
80
81
|
)
|
82
|
+
|
83
|
+
@property
|
84
|
+
def engine(self) -> Engine:
|
85
|
+
return self
|
86
|
+
|
87
|
+
@property
|
88
|
+
def driver(self) -> str:
|
89
|
+
return self.dialect.driver
|
90
|
+
|
91
|
+
@property
|
92
|
+
def name(self) -> str:
|
93
|
+
return self.dialect.name
|
ormlambda/engine/create.py
CHANGED
@@ -18,4 +18,9 @@ def create_engine(url: URL | str, **kwargs: Any) -> base.Engine:
|
|
18
18
|
dialect_args["dbapi"] = dialect_cls.import_dbapi()
|
19
19
|
|
20
20
|
dialect = dialect_cls(**dialect_args)
|
21
|
-
|
21
|
+
|
22
|
+
repositoryclass = dialect.get_dialect_pool_class(u)
|
23
|
+
|
24
|
+
repository_args = {"dialect": dialect, **kwargs}
|
25
|
+
repository = repositoryclass(u, **repository_args)
|
26
|
+
return base.Engine(repository, dialect, u)
|
@@ -1,12 +1,13 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: ormlambda
|
3
|
-
Version: 4.0.
|
3
|
+
Version: 4.0.5
|
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
|
@@ -17,11 +17,11 @@ ormlambda/common/interfaces/IJoinSelector.py,sha256=-w-MJmwq65tpDLtigWSLgvAqeOl7
|
|
17
17
|
ormlambda/common/interfaces/INonQueryCommand.py,sha256=7CjLW4sKqkR5zUIGvhRXOtzTs6vypJW1a9EJHlgCw2c,260
|
18
18
|
ormlambda/common/interfaces/IQueryCommand.py,sha256=PKkAI1SE6U7kcbqFgQsdTQ3asIx-gIp5RDXYlBfANJk,461
|
19
19
|
ormlambda/common/interfaces/__init__.py,sha256=-qIJf5fBX0y0vq_O7YjImWFimbj5pqONzK8udH2CMX4,169
|
20
|
-
ormlambda/dialects/__init__.py,sha256
|
20
|
+
ormlambda/dialects/__init__.py,sha256=iykTU_kv3w_FaLWZuxxcVUfvUznrM1YNWyABYlZqEXg,3736
|
21
21
|
ormlambda/dialects/default/__init__.py,sha256=N1B0LKEDu7r2-mTF9mBA4ReyhYeDuJDnbQCiH4hJvFQ,33
|
22
|
-
ormlambda/dialects/default/base.py,sha256
|
22
|
+
ormlambda/dialects/default/base.py,sha256=-cxwjUipQITbIPqWV7N0H8UlIXgxs-qeQhJlDbAHvL8,1089
|
23
23
|
ormlambda/dialects/mysql/__init__.py,sha256=DwoefrtyJUivg7z4QS4K2k0DrUu04ItC5LJcDQEYZWg,1398
|
24
|
-
ormlambda/dialects/mysql/base.py,sha256=
|
24
|
+
ormlambda/dialects/mysql/base.py,sha256=jtt1US1wILOebN7hfYmN9JzreG-_Awv9ahmzNPK0z_k,21539
|
25
25
|
ormlambda/dialects/mysql/caster/__init__.py,sha256=Df2sdZaAJ1Mi5Ego0sILMk5pF1NbK-nlV0hbpzd0PWE,47
|
26
26
|
ormlambda/dialects/mysql/caster/caster.py,sha256=G2CDqkrmsxFrHe_nDOmqqrTA_3O2o6gIIfukqPeHmJs,1021
|
27
27
|
ormlambda/dialects/mysql/caster/types/__init__.py,sha256=BmtHuVvKGPIOCjVuqQZgtGBMnx15YnGBaBi4r3Hd-3U,587
|
@@ -49,8 +49,8 @@ ormlambda/dialects/sqlite/__init__.py,sha256=2EMmxD7ORtGoD18GJ_9aC_tPutAq9ormMZJ
|
|
49
49
|
ormlambda/dialects/sqlite/base.py,sha256=24LSB461yQDEnXa-TsQt_srJmBCAR6M6419pa40CL_4,1503
|
50
50
|
ormlambda/dialects/sqlite/pysqlite.py,sha256=dZY0NV2IvSTk3DNEDyncstmIABKj3M2xfmhf2dc2zQs,680
|
51
51
|
ormlambda/engine/__init__.py,sha256=JpCLfuW1zcJi4ki97ajXh0aQxMSvWBKzDlBZx9ZVF9o,132
|
52
|
-
ormlambda/engine/base.py,sha256=
|
53
|
-
ormlambda/engine/create.py,sha256=
|
52
|
+
ormlambda/engine/base.py,sha256=BUzSRGbe-_dlh71gdHNlD1z8OyiM2K3QAV-Ul5JV_XQ,2868
|
53
|
+
ormlambda/engine/create.py,sha256=z9MDi_ldwuCa4b_Oe-orgt6Fk1EagsjKmLHZvJ0jHN8,711
|
54
54
|
ormlambda/engine/url.py,sha256=ZzdgZU_Cnjhonbbr5OfBvq_ThUPnDj9v-3-7O54ENm0,26137
|
55
55
|
ormlambda/engine/utils.py,sha256=fFoiKsiFuLcjcBVYNebVoYnMrEj3aZdoxEVSNfCY-GM,522
|
56
56
|
ormlambda/env.py,sha256=rCZKT2rpvRF3hPtkLmtiaVAIxQ0xj8tF7ZKJpFp7BkA,736
|
@@ -58,7 +58,7 @@ ormlambda/errors.py,sha256=ltLR52g3fnUTjrDC_x_R9-b5LlLjC6bVACnOoc9-OZg,839
|
|
58
58
|
ormlambda/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
59
|
ormlambda/model/base_model.py,sha256=lhtJWiGXiRWLOxsuPg0PPr53shhreMy69Ps2-7dYU7U,739
|
60
60
|
ormlambda/repository/__init__.py,sha256=4KAhKn6vWV7bslewvGMNqbbbUnz1DLnH4yy-M5QNAQA,112
|
61
|
-
ormlambda/repository/base_repository.py,sha256=
|
61
|
+
ormlambda/repository/base_repository.py,sha256=QGFPDg_Y12YEOEJYjkvsHErJS5-IIPxejTVwnnf_qzI,1322
|
62
62
|
ormlambda/repository/interfaces/IDatabaseConnection.py,sha256=pxczjx0b53yjjg5hvVDloMgUTFDahVC3HlJLQjo9_1w,283
|
63
63
|
ormlambda/repository/interfaces/IRepositoryBase.py,sha256=jTlViARH5SWIcYXstmXhttvNOShJ5mmAbTEmfGLiRuA,3527
|
64
64
|
ormlambda/repository/interfaces/__init__.py,sha256=t8Mn0aRZm8uF4MGaqjEANTTADCdOwNF0THZ_qebyzwo,126
|
@@ -132,8 +132,8 @@ ormlambda/util/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkj
|
|
132
132
|
ormlambda/util/module_tree/dynamic_module.py,sha256=SQ1FZW2Es5CdACD0VS8v_UZQTuFYbUWs6diAtMbKMoA,8699
|
133
133
|
ormlambda/util/preloaded.py,sha256=1D7t25qPjhW44nRez4Sd40gLjrl6BctLhPfPsK6Dx5g,3064
|
134
134
|
ormlambda/util/typing.py,sha256=py6FbOLvnuByR8IHgKIIReFM0efX6Bzz-Ick9fx-nuw,423
|
135
|
-
ormlambda-4.0.
|
136
|
-
ormlambda-4.0.
|
137
|
-
ormlambda-4.0.
|
138
|
-
ormlambda-4.0.
|
139
|
-
ormlambda-4.0.
|
135
|
+
ormlambda-4.0.5.dist-info/AUTHORS,sha256=uWpOHaCPTOLbVkk5x9McoLwbgzSeCg7yILeDRyMGWGM,606
|
136
|
+
ormlambda-4.0.5.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
|
137
|
+
ormlambda-4.0.5.dist-info/METADATA,sha256=9nElZo731sVCQr5dvymaDAIfypgU71R6PnJmJgcCOsg,12517
|
138
|
+
ormlambda-4.0.5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
139
|
+
ormlambda-4.0.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|