ormlambda 3.11.2__py3-none-any.whl → 3.34.0__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 +3 -1
- ormlambda/caster/__init__.py +1 -1
- ormlambda/caster/caster.py +29 -12
- ormlambda/common/abstract_classes/clause_info_converter.py +65 -0
- ormlambda/common/abstract_classes/decomposition_query.py +27 -68
- ormlambda/common/abstract_classes/non_query_base.py +10 -8
- ormlambda/common/abstract_classes/query_base.py +3 -1
- ormlambda/common/errors/__init__.py +29 -0
- ormlambda/common/interfaces/ICustomAlias.py +1 -1
- ormlambda/common/interfaces/IQueryCommand.py +6 -2
- ormlambda/dialects/__init__.py +39 -0
- ormlambda/dialects/default/__init__.py +1 -0
- ormlambda/dialects/default/base.py +39 -0
- ormlambda/dialects/interface/__init__.py +1 -0
- ormlambda/dialects/interface/dialect.py +78 -0
- ormlambda/dialects/mysql/__init__.py +38 -0
- ormlambda/dialects/mysql/base.py +388 -0
- ormlambda/dialects/mysql/caster/caster.py +39 -0
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/__init__.py +1 -0
- ormlambda/dialects/mysql/caster/types/boolean.py +35 -0
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/bytes.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/datetime.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/float.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/int.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/iterable.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/none.py +8 -7
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/point.py +4 -4
- ormlambda/{databases/my_sql → dialects/mysql}/caster/types/string.py +7 -7
- ormlambda/{databases/my_sql → dialects/mysql}/clauses/ST_AsText.py +8 -7
- ormlambda/{databases/my_sql → dialects/mysql}/clauses/ST_Contains.py +10 -5
- ormlambda/dialects/mysql/clauses/__init__.py +13 -0
- ormlambda/dialects/mysql/clauses/count.py +33 -0
- ormlambda/dialects/mysql/clauses/delete.py +9 -0
- ormlambda/dialects/mysql/clauses/group_by.py +17 -0
- ormlambda/dialects/mysql/clauses/having.py +12 -0
- ormlambda/dialects/mysql/clauses/insert.py +9 -0
- ormlambda/dialects/mysql/clauses/joins.py +14 -0
- ormlambda/dialects/mysql/clauses/limit.py +6 -0
- ormlambda/dialects/mysql/clauses/offset.py +6 -0
- ormlambda/dialects/mysql/clauses/order.py +8 -0
- ormlambda/dialects/mysql/clauses/update.py +8 -0
- ormlambda/dialects/mysql/clauses/upsert.py +9 -0
- ormlambda/dialects/mysql/clauses/where.py +7 -0
- ormlambda/dialects/mysql/mysqlconnector.py +46 -0
- ormlambda/dialects/mysql/repository/__init__.py +1 -0
- ormlambda/dialects/mysql/repository/repository.py +212 -0
- ormlambda/dialects/mysql/types.py +732 -0
- ormlambda/dialects/sqlite/__init__.py +5 -0
- ormlambda/dialects/sqlite/base.py +47 -0
- ormlambda/dialects/sqlite/pysqlite.py +32 -0
- ormlambda/engine/__init__.py +1 -0
- ormlambda/engine/base.py +77 -0
- ormlambda/engine/create.py +9 -23
- ormlambda/engine/url.py +34 -19
- ormlambda/env.py +30 -0
- ormlambda/errors.py +17 -0
- ormlambda/model/base_model.py +7 -9
- ormlambda/repository/base_repository.py +36 -5
- ormlambda/repository/interfaces/IRepositoryBase.py +119 -12
- ormlambda/repository/response.py +134 -0
- ormlambda/sql/clause_info/__init__.py +2 -1
- ormlambda/sql/clause_info/aggregate_function_base.py +96 -0
- ormlambda/sql/clause_info/clause_info.py +35 -115
- ormlambda/sql/clause_info/interface/IClauseInfo.py +37 -0
- ormlambda/sql/clause_info/interface/__init__.py +1 -0
- ormlambda/sql/clauses/__init__.py +14 -0
- ormlambda/{databases/my_sql → sql}/clauses/alias.py +23 -6
- ormlambda/{databases/my_sql → sql}/clauses/count.py +15 -1
- ormlambda/{databases/my_sql → sql}/clauses/delete.py +22 -7
- ormlambda/sql/clauses/group_by.py +30 -0
- ormlambda/{databases/my_sql → sql}/clauses/having.py +7 -2
- ormlambda/{databases/my_sql → sql}/clauses/insert.py +16 -9
- ormlambda/sql/clauses/interfaces/__init__.py +5 -0
- ormlambda/sql/clauses/join/__init__.py +1 -0
- ormlambda/{databases/my_sql → sql/clauses/join}/join_context.py +15 -7
- ormlambda/{databases/my_sql → sql}/clauses/joins.py +29 -19
- ormlambda/sql/clauses/limit.py +15 -0
- ormlambda/sql/clauses/offset.py +15 -0
- ormlambda/{databases/my_sql → sql}/clauses/order.py +14 -24
- ormlambda/{databases/my_sql → sql}/clauses/select.py +14 -13
- ormlambda/{databases/my_sql → sql}/clauses/update.py +24 -11
- ormlambda/{databases/my_sql → sql}/clauses/upsert.py +19 -10
- ormlambda/{databases/my_sql → sql}/clauses/where.py +28 -8
- ormlambda/sql/column/__init__.py +1 -0
- ormlambda/sql/{column.py → column/column.py} +85 -22
- ormlambda/sql/comparer.py +51 -37
- ormlambda/sql/compiler.py +668 -0
- ormlambda/sql/ddl.py +82 -0
- ormlambda/sql/elements.py +36 -0
- ormlambda/sql/foreign_key.py +61 -39
- ormlambda/{databases/my_sql → sql}/functions/concat.py +13 -5
- ormlambda/{databases/my_sql → sql}/functions/max.py +9 -4
- ormlambda/{databases/my_sql → sql}/functions/min.py +9 -13
- ormlambda/{databases/my_sql → sql}/functions/sum.py +8 -10
- ormlambda/sql/sqltypes.py +647 -0
- ormlambda/sql/table/__init__.py +1 -1
- ormlambda/sql/table/table.py +175 -0
- ormlambda/sql/table/table_constructor.py +1 -208
- ormlambda/sql/type_api.py +35 -0
- ormlambda/sql/types.py +3 -1
- ormlambda/sql/visitors.py +74 -0
- ormlambda/statements/__init__.py +1 -0
- ormlambda/statements/base_statement.py +34 -40
- ormlambda/statements/interfaces/IStatements.py +28 -21
- ormlambda/statements/query_builder.py +163 -0
- ormlambda/{databases/my_sql → statements}/statements.py +68 -210
- ormlambda/statements/types.py +2 -2
- ormlambda/types/__init__.py +24 -0
- ormlambda/types/metadata.py +42 -0
- ormlambda/util/__init__.py +87 -0
- ormlambda/{utils → util}/module_tree/dynamic_module.py +4 -3
- ormlambda/util/plugin_loader.py +32 -0
- ormlambda/util/typing.py +6 -0
- ormlambda-3.34.0.dist-info/AUTHORS +32 -0
- {ormlambda-3.11.2.dist-info → ormlambda-3.34.0.dist-info}/METADATA +56 -10
- ormlambda-3.34.0.dist-info/RECORD +152 -0
- ormlambda/components/__init__.py +0 -4
- ormlambda/components/delete/__init__.py +0 -2
- ormlambda/components/delete/abstract_delete.py +0 -17
- ormlambda/components/insert/__init__.py +0 -2
- ormlambda/components/insert/abstract_insert.py +0 -25
- ormlambda/components/select/__init__.py +0 -1
- ormlambda/components/update/__init__.py +0 -2
- ormlambda/components/update/abstract_update.py +0 -29
- ormlambda/components/upsert/__init__.py +0 -2
- ormlambda/components/upsert/abstract_upsert.py +0 -25
- ormlambda/databases/__init__.py +0 -5
- ormlambda/databases/my_sql/__init__.py +0 -4
- ormlambda/databases/my_sql/caster/caster.py +0 -39
- ormlambda/databases/my_sql/clauses/__init__.py +0 -20
- ormlambda/databases/my_sql/clauses/create_database.py +0 -35
- ormlambda/databases/my_sql/clauses/drop_database.py +0 -17
- ormlambda/databases/my_sql/clauses/drop_table.py +0 -23
- ormlambda/databases/my_sql/clauses/group_by.py +0 -31
- ormlambda/databases/my_sql/clauses/limit.py +0 -17
- ormlambda/databases/my_sql/clauses/offset.py +0 -17
- ormlambda/databases/my_sql/repository/__init__.py +0 -1
- ormlambda/databases/my_sql/repository/repository.py +0 -351
- ormlambda/engine/template.py +0 -47
- ormlambda/sql/dtypes.py +0 -94
- ormlambda/utils/__init__.py +0 -1
- ormlambda-3.11.2.dist-info/RECORD +0 -120
- /ormlambda/{databases/my_sql → dialects/mysql}/caster/__init__.py +0 -0
- /ormlambda/{databases/my_sql/types.py → dialects/mysql/repository/pool_types.py} +0 -0
- /ormlambda/{components/delete → sql/clauses/interfaces}/IDelete.py +0 -0
- /ormlambda/{components/insert → sql/clauses/interfaces}/IInsert.py +0 -0
- /ormlambda/{components/select → sql/clauses/interfaces}/ISelect.py +0 -0
- /ormlambda/{components/update → sql/clauses/interfaces}/IUpdate.py +0 -0
- /ormlambda/{components/upsert → sql/clauses/interfaces}/IUpsert.py +0 -0
- /ormlambda/{databases/my_sql → sql}/functions/__init__.py +0 -0
- /ormlambda/{utils → util}/module_tree/__init__.py +0 -0
- /ormlambda/{utils → util}/module_tree/dfs_traversal.py +0 -0
- {ormlambda-3.11.2.dist-info → ormlambda-3.34.0.dist-info}/LICENSE +0 -0
- {ormlambda-3.11.2.dist-info → ormlambda-3.34.0.dist-info}/WHEEL +0 -0
ormlambda/util/typing.py
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
ormlambda was created by Pablo hernandez.
|
2
|
+
|
3
|
+
Some files was originally written by other authors from sqlalchemy library and rewritten by Pablo Hernandez
|
4
|
+
|
5
|
+
Major contributing authors include:
|
6
|
+
|
7
|
+
- Pablo Hernandez
|
8
|
+
- Jason Kirtland
|
9
|
+
- Michael Trier
|
10
|
+
- Diana Clarke
|
11
|
+
- Gaetan de Menten
|
12
|
+
- Lele Gaifax
|
13
|
+
- Jonathan Ellis
|
14
|
+
- Gord Thompson
|
15
|
+
- Federico Caselli
|
16
|
+
- Philip Jenvey
|
17
|
+
- Rick Morrison
|
18
|
+
- Chris Withers
|
19
|
+
- Ants Aasma
|
20
|
+
- Sheila Allen
|
21
|
+
- Paul Johnston
|
22
|
+
- Tony Locke
|
23
|
+
- Hajime Nakagami
|
24
|
+
- Vraj Mohan
|
25
|
+
- Robert Leftwich
|
26
|
+
- Taavi Burns
|
27
|
+
- Jonathan Vanasco
|
28
|
+
- Jeff Widman
|
29
|
+
- Scott Dugas
|
30
|
+
- Dobes Vandermeer
|
31
|
+
- Ville Skytta
|
32
|
+
- Rodrigo Menezes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ormlambda
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.34.0
|
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
|
@@ -316,7 +316,7 @@ res = AddressModel.count(Address.address_id, execute=True)
|
|
316
316
|
|
317
317
|
The `concat` method allows you to concatenate multiple columns or values into a single string. This is particularly useful for creating derived fields in your queries.
|
318
318
|
|
319
|
-
|
319
|
+
### Usage
|
320
320
|
|
321
321
|
```python
|
322
322
|
response = ORM(Address, db).where(Address.City.Country.country.regex(r"^Spain")).first(
|
@@ -347,6 +347,60 @@ As you can see in the response, the result is a dictionary where the keys are a
|
|
347
347
|
|
348
348
|
Another elegant approach to adjust the response and obtain an object is by using the `flavour` attribute. You can pass a callable object, which will be used to instantiate it with the returned data.
|
349
349
|
|
350
|
+
|
351
|
+
## 2. Group by
|
352
|
+
|
353
|
+
The `groupby` method is used to filter results based on aggregate functions.
|
354
|
+
|
355
|
+
### Usage
|
356
|
+
```python
|
357
|
+
from ormlambda import Column, ORM, create_engine
|
358
|
+
from test.config import DATABASE_URL
|
359
|
+
|
360
|
+
|
361
|
+
class Response(BaseModel):
|
362
|
+
district: str
|
363
|
+
count: int
|
364
|
+
|
365
|
+
engine= create_engine(DATABASE_URL)
|
366
|
+
model = ORM(Address,engine)
|
367
|
+
|
368
|
+
count_name = Column(column_name="count")
|
369
|
+
|
370
|
+
res = (
|
371
|
+
self.model
|
372
|
+
.groupby(Address.district)
|
373
|
+
.select(
|
374
|
+
(
|
375
|
+
Address.district,
|
376
|
+
self.model.count(Address.address),
|
377
|
+
),
|
378
|
+
flavour=Response,
|
379
|
+
)
|
380
|
+
)
|
381
|
+
```
|
382
|
+
|
383
|
+
## 3. Having
|
384
|
+
|
385
|
+
The `having` method is used to filter results based on aggregate functions. It is typically used in conjunction with `group by` clauses.
|
386
|
+
|
387
|
+
### Usage
|
388
|
+
```python
|
389
|
+
res = (
|
390
|
+
model
|
391
|
+
.groupby(Address.district)
|
392
|
+
.having(count_name > 4)
|
393
|
+
.select(
|
394
|
+
(
|
395
|
+
Address.district,
|
396
|
+
model.count(Address.address),
|
397
|
+
),
|
398
|
+
flavour=Response,
|
399
|
+
)
|
400
|
+
)
|
401
|
+
```
|
402
|
+
|
403
|
+
|
350
404
|
## Using BaseModel for Custom Responses (Pydantic)
|
351
405
|
|
352
406
|
You can utilize `BaseModel` from Pydantic to create structured response models. This allows you to define the expected structure of your data, ensuring type safety and validation.
|
@@ -391,14 +445,6 @@ print(select.city)
|
|
391
445
|
print(select.country)
|
392
446
|
```
|
393
447
|
|
394
|
-
|
395
|
-
<!-- ### 2. Having
|
396
|
-
|
397
|
-
The `having` method is used to filter results based on aggregate functions. It is typically used in conjunction with `group by` clauses.
|
398
|
-
|
399
|
-
#### Usage -->
|
400
|
-
|
401
|
-
|
402
448
|
## Combine aggregation method
|
403
449
|
As shown in the previous examples, setting the `execute` attribute to `True` allows us to perform the corresponding query in a single line. However, if you're looking to improve efficiency, you can combine all of them into one query.
|
404
450
|
```python
|
@@ -0,0 +1,152 @@
|
|
1
|
+
ormlambda/__init__.py,sha256=0s-uDYwzCsRAdN1z_dfzi6rb-9EiR3wcbSgQNJHxlyE,772
|
2
|
+
ormlambda/caster/__init__.py,sha256=lXzW6TJwgtyFTaBhKBETyGIxEje005S3SPg7PXnYEVQ,137
|
3
|
+
ormlambda/caster/base_caster.py,sha256=c3vCGoKDyJ39kfUiS7sNKhKdjBRYSK1Ie88lwDIXqgE,1774
|
4
|
+
ormlambda/caster/caster.py,sha256=2iilDARnNGGh-NVJKXr7nhxjoaQOLJGk3RnGoSzHpOY,2453
|
5
|
+
ormlambda/caster/interfaces/ICaster.py,sha256=MCBBVBho9KH67vCcUk8nclY0a7QoqxgdyVJJR0-QDT0,759
|
6
|
+
ormlambda/caster/interfaces/__init__.py,sha256=TRoIxxgxuhUhCJq2ldLS3UEa1THrMXEIyTH5K46vyGw,43
|
7
|
+
ormlambda/common/__init__.py,sha256=g4yGxH4WEgvQ7Rix4lpp3FQ-3SeRhptNd5sabgZLQNk,59
|
8
|
+
ormlambda/common/abstract_classes/__init__.py,sha256=l39_WaBH38wrDV2KXb83c73ct7oxSIIVj2Ep4UcvxrU,186
|
9
|
+
ormlambda/common/abstract_classes/clause_info_converter.py,sha256=VdJKOfIJNjmMoeYFyqBb4tPSTswQJ-rIa5Ilj8vs5og,3086
|
10
|
+
ormlambda/common/abstract_classes/decomposition_query.py,sha256=_mANVU876xmZ1_Jf2IRLaOD3iOuEE9kurFDP9NalpgE,5506
|
11
|
+
ormlambda/common/abstract_classes/non_query_base.py,sha256=eLXAprXVjVk2sFF8X8EK0UKoOQpgxBlDRn8prLzjr30,1201
|
12
|
+
ormlambda/common/abstract_classes/query_base.py,sha256=KX1xQCfZ3kK13E1ipAFo91oXmBh0PyKRq4Xf59vsnG0,372
|
13
|
+
ormlambda/common/enums/__init__.py,sha256=4lVKCHi1JalwgNzjsAXqX-C54NJEH83y2v5baMO8fN4,103
|
14
|
+
ormlambda/common/enums/condition_types.py,sha256=QZnhhlTwzLcZ9kkmG6a08fQjUUJsJ5XGAH7QCiJRL1A,330
|
15
|
+
ormlambda/common/enums/join_type.py,sha256=EosZVnvAc72LlZHuICIgoKWwUJzhvWOIIAohcbDYPQo,354
|
16
|
+
ormlambda/common/errors/__init__.py,sha256=KLtFsctG5-LRu-mQ124FHeEqvE3K9fmf5hUt5HrBmR8,1995
|
17
|
+
ormlambda/common/global_checker.py,sha256=9FtdGl0SCSLEBBFBtburmP_Sh5h2tx88ZG08vjUordc,894
|
18
|
+
ormlambda/common/interfaces/ICustomAlias.py,sha256=GS-Riw_8yCr7N9DXSf5nZxkrwMH6eomNd-BdEhCA7fY,161
|
19
|
+
ormlambda/common/interfaces/IDecompositionQuery.py,sha256=2fwcXONBnYpxL1YHPHaLxqQJ4NANGuTky69QNa74xd4,853
|
20
|
+
ormlambda/common/interfaces/IJoinSelector.py,sha256=-w-MJmwq65tpDLtigWSLgvAqeOl75DA-EyWIugNkfCs,490
|
21
|
+
ormlambda/common/interfaces/INonQueryCommand.py,sha256=7CjLW4sKqkR5zUIGvhRXOtzTs6vypJW1a9EJHlgCw2c,260
|
22
|
+
ormlambda/common/interfaces/IQueryCommand.py,sha256=13vm_adVZ51BumMnNPHrqhzdC1pQVfZEVb6pkZgK-EU,475
|
23
|
+
ormlambda/common/interfaces/__init__.py,sha256=np5wuAnBVAHDyD01-X3M9qPmzbjOzP6KNAj9BFazGd4,300
|
24
|
+
ormlambda/dialects/__init__.py,sha256=srorTnQfbyn7meJej4rJPR5xwnxwlbhPXl6jJ8ocUIA,865
|
25
|
+
ormlambda/dialects/default/__init__.py,sha256=N1B0LKEDu7r2-mTF9mBA4ReyhYeDuJDnbQCiH4hJvFQ,33
|
26
|
+
ormlambda/dialects/default/base.py,sha256=rmK-nV5luN2lphSgisM8TBy3s4JXVgvZa79ATHeVOuU,1088
|
27
|
+
ormlambda/dialects/interface/__init__.py,sha256=IbB5o6ae7XNVVfNt4uqZRZcVK9HHG6eLLK_E0J99kwY,43
|
28
|
+
ormlambda/dialects/interface/dialect.py,sha256=z47GXCi-uJ6Oq7Zm64OHM0q61T3xWCss-uGdcuuXng0,2810
|
29
|
+
ormlambda/dialects/mysql/__init__.py,sha256=_rQVMxQHYOBHw0qjAw4XZUuhQ1fw63fmON4HSbS4-po,585
|
30
|
+
ormlambda/dialects/mysql/base.py,sha256=HVu42IdA63sY5yh7U8NQFnddllXvw02yfscmZVEUJsg,11692
|
31
|
+
ormlambda/dialects/mysql/caster/__init__.py,sha256=Df2sdZaAJ1Mi5Ego0sILMk5pF1NbK-nlV0hbpzd0PWE,47
|
32
|
+
ormlambda/dialects/mysql/caster/caster.py,sha256=kuGp3Kq5sFsUylGdqX5BOFWxxZdXoO_iyGk1PYy2Beo,854
|
33
|
+
ormlambda/dialects/mysql/caster/types/__init__.py,sha256=nE2bHykuvxTu49nzZ48_PbVe6J62pbWunHBJT2mfoM8,448
|
34
|
+
ormlambda/dialects/mysql/caster/types/boolean.py,sha256=EYOxnR7-XU30UYZbBbMH4pyynTw5CPU1G8V5xpCthg4,1100
|
35
|
+
ormlambda/dialects/mysql/caster/types/bytes.py,sha256=Mzl5oI2q6hGL9TFrTS-Ae1olQlAVtvNoxTSLUSBb5v8,1026
|
36
|
+
ormlambda/dialects/mysql/caster/types/datetime.py,sha256=ISzcsbwijTa2wC9ZD8zy5piRm9BdnT9GxkMNf4FQYug,1189
|
37
|
+
ormlambda/dialects/mysql/caster/types/float.py,sha256=EbU6J3yoL5_naLowfibkfUC9Bk9WzDaWks7lJ2pNhyA,1026
|
38
|
+
ormlambda/dialects/mysql/caster/types/int.py,sha256=a30xbe0LNj2BvbtLNZhUXFvT3WJ115MFsHC19Y3NLTk,1016
|
39
|
+
ormlambda/dialects/mysql/caster/types/iterable.py,sha256=nFPMOiaahzw_HWSdMZLRDQVim0aWUMoP-OLvp7vONC4,1029
|
40
|
+
ormlambda/dialects/mysql/caster/types/none.py,sha256=Bl4jpVVyoLG7ehoCAYj9lFBZbRWbyDN8QsQeWmIb84I,948
|
41
|
+
ormlambda/dialects/mysql/caster/types/point.py,sha256=GHAf51kE0AS7wOlCYM9YW-z2ZbmY8hXwcHs979ZCeaY,1442
|
42
|
+
ormlambda/dialects/mysql/caster/types/string.py,sha256=WFjTC5phuJ_-ShuokndFbqGuFgGZZx9GbpozH4rlB2g,1017
|
43
|
+
ormlambda/dialects/mysql/clauses/ST_AsText.py,sha256=YrBf-cbkyjI_335IaOZ1LC-vgh1y3PqVOcBTrKj95Hs,1278
|
44
|
+
ormlambda/dialects/mysql/clauses/ST_Contains.py,sha256=xzIWxJftryVoQCKUmV7TtGDkFAzUFhINXxLcWhuwac4,1189
|
45
|
+
ormlambda/dialects/mysql/clauses/__init__.py,sha256=z9PcBxAATLm5fbl6S6_mTRC58zhA1JL9W4Ftliv4mRc,508
|
46
|
+
ormlambda/dialects/mysql/clauses/count.py,sha256=sY2c5KlLT724DODLnJOjZZe14RdfoZvf1z3MjVVwAT4,1032
|
47
|
+
ormlambda/dialects/mysql/clauses/delete.py,sha256=v38-Mq32uE5LRXzD0gME5MFtw2QK5qwxacv_B69wLeE,336
|
48
|
+
ormlambda/dialects/mysql/clauses/group_by.py,sha256=tYFIlcY5gTi1qcPrCtkbwSJeEZ7gF6DJ8puf6sdgyaE,402
|
49
|
+
ormlambda/dialects/mysql/clauses/having.py,sha256=GTgjS_KJ4umxB2wgt533cfFn8T0Dx7GvMgJL3cHXIAs,342
|
50
|
+
ormlambda/dialects/mysql/clauses/insert.py,sha256=RYQh8lgAl-Aua-xQneVmn310ouJSAU7F4EJJ5VxuyX4,294
|
51
|
+
ormlambda/dialects/mysql/clauses/joins.py,sha256=0GUd1YMPaZdboqGOPSM1sCFBKPO7DQOG5K5mzeTSeBw,448
|
52
|
+
ormlambda/dialects/mysql/clauses/limit.py,sha256=uIV54zFLlkthaxBFp-qKGfWkKooeWdrHvuRhVlj0qiw,127
|
53
|
+
ormlambda/dialects/mysql/clauses/offset.py,sha256=Fffxmya1B70cjjOTqk9RjoVZHnyFfgjBb8KdLPPL0MM,130
|
54
|
+
ormlambda/dialects/mysql/clauses/order.py,sha256=lD08cc9_jQSYKJppp_NQqMira9t1FXfmeGBYlPpCrUU,210
|
55
|
+
ormlambda/dialects/mysql/clauses/update.py,sha256=up0zRl8hhVbQHzkgiHaO3V6DlbU0ystTue-xmE3WV7o,234
|
56
|
+
ormlambda/dialects/mysql/clauses/upsert.py,sha256=xEvdGdQVUu6so_CQKdqLMwIo_B-gm3dGRD2bWsV8N6s,238
|
57
|
+
ormlambda/dialects/mysql/clauses/where.py,sha256=JCqKfMCt_tiUXtLa-DW0y6_IyNqIxLC6-iju_94oeBA,242
|
58
|
+
ormlambda/dialects/mysql/mysqlconnector.py,sha256=DOjK7U7LOhjuVQJULzAV8xaRGX0OlBU8APUeRiTcbDY,1378
|
59
|
+
ormlambda/dialects/mysql/repository/__init__.py,sha256=DVXF2zWiG1WvHRRdXcxcHg2PSAioaS2P6Qlwx6xpRuE,39
|
60
|
+
ormlambda/dialects/mysql/repository/pool_types.py,sha256=6c7LMS1VGR8ko1LB1T8DQzn1l10Mzk8PfIeYEOb9w30,1839
|
61
|
+
ormlambda/dialects/mysql/repository/repository.py,sha256=-LwEWRvyq6_DDmWD2sWiH9x12x0RUDmH94ZID1Xyvac,7067
|
62
|
+
ormlambda/dialects/mysql/types.py,sha256=lOhdi442saxQJlQ_jgChBETE0fFMGTQLWN0a76R4fkc,23453
|
63
|
+
ormlambda/dialects/sqlite/__init__.py,sha256=2EMmxD7ORtGoD18GJ_9aC_tPutAq9ormMZJmaJ5nkYA,103
|
64
|
+
ormlambda/dialects/sqlite/base.py,sha256=24LSB461yQDEnXa-TsQt_srJmBCAR6M6419pa40CL_4,1503
|
65
|
+
ormlambda/dialects/sqlite/pysqlite.py,sha256=dZY0NV2IvSTk3DNEDyncstmIABKj3M2xfmhf2dc2zQs,680
|
66
|
+
ormlambda/engine/__init__.py,sha256=JpCLfuW1zcJi4ki97ajXh0aQxMSvWBKzDlBZx9ZVF9o,132
|
67
|
+
ormlambda/engine/base.py,sha256=P63f6N471slfvfrYyLInhzN-Sqs1RJJns-MQbnrrpf4,2548
|
68
|
+
ormlambda/engine/create.py,sha256=caDYXX4BP5uODSrdJXRZvWWjbliDgH1TiSvhtHP3RNY,533
|
69
|
+
ormlambda/engine/url.py,sha256=ZzdgZU_Cnjhonbbr5OfBvq_ThUPnDj9v-3-7O54ENm0,26137
|
70
|
+
ormlambda/engine/utils.py,sha256=fFoiKsiFuLcjcBVYNebVoYnMrEj3aZdoxEVSNfCY-GM,522
|
71
|
+
ormlambda/env.py,sha256=rCZKT2rpvRF3hPtkLmtiaVAIxQ0xj8tF7ZKJpFp7BkA,736
|
72
|
+
ormlambda/errors.py,sha256=ddv_848pl53seKJoXe3mElmatQiwEScwfGkCXU1XZkM,504
|
73
|
+
ormlambda/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
|
+
ormlambda/model/base_model.py,sha256=kgobamJ4GHmDEU-g2YTVIPTXPJFnNK3rsQOm2rXq4kU,903
|
75
|
+
ormlambda/repository/__init__.py,sha256=4KAhKn6vWV7bslewvGMNqbbbUnz1DLnH4yy-M5QNAQA,112
|
76
|
+
ormlambda/repository/base_repository.py,sha256=CzHU-yUCycMqTp8RFI0mj2hS2RgC9INu3X20HsgyEKA,1270
|
77
|
+
ormlambda/repository/interfaces/IDatabaseConnection.py,sha256=pxczjx0b53yjjg5hvVDloMgUTFDahVC3HlJLQjo9_1w,283
|
78
|
+
ormlambda/repository/interfaces/IRepositoryBase.py,sha256=jTlViARH5SWIcYXstmXhttvNOShJ5mmAbTEmfGLiRuA,3527
|
79
|
+
ormlambda/repository/interfaces/__init__.py,sha256=t8Mn0aRZm8uF4MGaqjEANTTADCdOwNF0THZ_qebyzwo,126
|
80
|
+
ormlambda/repository/response.py,sha256=TBmWUGGoZChjXVhZXU3F84eUUA1rf7VPeNi92Ae8-2I,4506
|
81
|
+
ormlambda/sql/__init__.py,sha256=0CWQzfxhTRWXozoRsg460o_ZwjW9w4uyL5jQUcD4eHg,121
|
82
|
+
ormlambda/sql/clause_info/__init__.py,sha256=wOr8M0ZW7fJ-OGHok9eExh7fVP6kiwqGckEsKdE0U7A,255
|
83
|
+
ormlambda/sql/clause_info/aggregate_function_base.py,sha256=FCTrXhDvO_XDVBXZK5AiUHonDENHT_MFxW6kn2_--6E,3541
|
84
|
+
ormlambda/sql/clause_info/clause_info.py,sha256=ypiBjvuij4iKdMAkTPy7jlCa7hZIEi11agsaVCoHtKM,12674
|
85
|
+
ormlambda/sql/clause_info/clause_info_context.py,sha256=Y32p3x4mqcdNHbAowrKaN_ldnGn7zvaP1UdAkWWryhM,2852
|
86
|
+
ormlambda/sql/clause_info/interface/IAggregate.py,sha256=P-QPaTMAMHVR5M9-ClmL8wsj0uNGG5xpxjuAwWnzKxA,216
|
87
|
+
ormlambda/sql/clause_info/interface/IClauseInfo.py,sha256=Gnr6vArgimCt0oJqW-_q2_5jMi8EDBW1wZ8rEF2uzTk,921
|
88
|
+
ormlambda/sql/clause_info/interface/__init__.py,sha256=bTNYVMPuJebEvQpPa5LBQaAesGnfljQ8BKsj1UxN09k,100
|
89
|
+
ormlambda/sql/clauses/__init__.py,sha256=9bkgw3jbd2HdB-WGQtpyHLr0K-SbCZcBU7KmHur7k1c,572
|
90
|
+
ormlambda/sql/clauses/alias.py,sha256=W58fwVYq7GS_xuPCQNIlAu_cDQZuD1AzHmr8-SdxTIg,1301
|
91
|
+
ormlambda/sql/clauses/count.py,sha256=I2-VFseieTw6tZlBy8jTJGbnW33OtgRwW0rFOumXLfs,1665
|
92
|
+
ormlambda/sql/clauses/delete.py,sha256=tTSCcSD_F-z9rl4HwfJOeb_M_XJlg-LkyU3f6vVQNTc,2289
|
93
|
+
ormlambda/sql/clauses/group_by.py,sha256=VC-XZ1Kk7cgnJjuu9Cu0dH1pUPBe60z_9hSiBL65puI,829
|
94
|
+
ormlambda/sql/clauses/having.py,sha256=14ojNXefgsc_T70ZraONsKTBQCge1TD-Q5nMigo8GWk,466
|
95
|
+
ormlambda/sql/clauses/insert.py,sha256=0Fsv41g--fC3VX3GHehlu5MoSqQ0MHAkeGs2xCM8vzU,3805
|
96
|
+
ormlambda/sql/clauses/interfaces/IDelete.py,sha256=06ZEdbKBxsHSwsGMBu0E1om4WJjojZAm-L3b95eQrcc,139
|
97
|
+
ormlambda/sql/clauses/interfaces/IInsert.py,sha256=YIfMPlKu7UGgnVpZuhpr0Mtnefe-O85hqk8-GZrVK7w,139
|
98
|
+
ormlambda/sql/clauses/interfaces/ISelect.py,sha256=saA0Iat4lXfd1vc7a7t6Stc_3BJHAysGWH1AcmrhQhw,372
|
99
|
+
ormlambda/sql/clauses/interfaces/IUpdate.py,sha256=U-3Wx8lyCglhxf9gCXWO3MVgydG6gfRpzp00_MHC5cU,168
|
100
|
+
ormlambda/sql/clauses/interfaces/IUpsert.py,sha256=2m6Bcwa0X80IDLnf0QErqr01uYEydOnRta9_T1nxjK4,139
|
101
|
+
ormlambda/sql/clauses/interfaces/__init__.py,sha256=JMWEyVwPEvx3NUgMOstCKLV5HemboHdF4KLwFeUEWwM,215
|
102
|
+
ormlambda/sql/clauses/join/__init__.py,sha256=7hwAB-nKaMirTT6uNZ1JtYNkkIx5zMSa6jaqr28d8Cg,67
|
103
|
+
ormlambda/sql/clauses/join/join_context.py,sha256=69R_X_RoWO2kXPgJ94Wck6s-sJjTIqFXpOifmLsYC9c,3497
|
104
|
+
ormlambda/sql/clauses/joins.py,sha256=w0c_uHNe3BNqL9-rAdQaAFeM6ExJXTNENG_sO7I2HWI,5505
|
105
|
+
ormlambda/sql/clauses/limit.py,sha256=NX9qUp_8Zd-0myZ80PhD2tbF72N5jsx_SaYakf7lNbU,345
|
106
|
+
ormlambda/sql/clauses/offset.py,sha256=FibzDho7Bc1UQchrPHjOakW_0BfZVupbuI62lHoha94,350
|
107
|
+
ormlambda/sql/clauses/order.py,sha256=qOcz2T0NQNY0H7vt-jbvBRjTy3X5Lw-kGSuISTGfAPA,1609
|
108
|
+
ormlambda/sql/clauses/select.py,sha256=gJfTqTCi32Knyp-rox_qo-JeoVYr6YWTEPl9FF8FsFg,1670
|
109
|
+
ormlambda/sql/clauses/update.py,sha256=s4Vl_CmZzUYvdP2ThrTDz2ps_nU3_uwROQNICD06qsw,3319
|
110
|
+
ormlambda/sql/clauses/upsert.py,sha256=1MlHSzIVXSnCnXx_0HqX_-JT1FAxaIKHImrv-OKjnWU,2250
|
111
|
+
ormlambda/sql/clauses/where.py,sha256=Db1IpXnbqAwzZpaThFDSxkrCNLsop__aJ43cDtcZ2Sk,2129
|
112
|
+
ormlambda/sql/column/__init__.py,sha256=MwBJznOoeNE7tK9oppVtC3784XPkKo0yq9VLlh2lWUY,41
|
113
|
+
ormlambda/sql/column/column.py,sha256=onneRMZJJd85sFkJZhgfcLTCChC-vHPcS7oukt-eSUY,7380
|
114
|
+
ormlambda/sql/comparer.py,sha256=_KQ6gYe0eUg5aOL1i70mV8a1Qa1jI5UQr-0VfAMgVzk,5482
|
115
|
+
ormlambda/sql/compiler.py,sha256=fdTuGLJNWSQ2z5KEmCpHQKTif9aAAzxgnQrQSAWMeZw,23768
|
116
|
+
ormlambda/sql/ddl.py,sha256=UK35fQ6tcSYvMhmqCNP8Wo2hBfLAOOomCSTGjMR2lPU,1934
|
117
|
+
ormlambda/sql/elements.py,sha256=ABWQQZn-3CnRLhxxMJYezCRqzt86b5KgZO6Qo55ReWQ,925
|
118
|
+
ormlambda/sql/foreign_key.py,sha256=BtIy4BgwCJmKtPlk1sr_Z-l5i9uJoSJjjp1FTERMIR8,5947
|
119
|
+
ormlambda/sql/functions/__init__.py,sha256=hA8t3mUpV2p-pO4TVp5rjC5Yp7aIkWPsS8NpLi3DUh0,171
|
120
|
+
ormlambda/sql/functions/concat.py,sha256=B3uh6SsNjK57jEYvyUW4YVpWGlByeapddDozCF7TYX4,1598
|
121
|
+
ormlambda/sql/functions/max.py,sha256=wXNhFmOlMyD1sKcaBO9asQeXcfY0OvMQPkrlARVXgdg,1651
|
122
|
+
ormlambda/sql/functions/min.py,sha256=MTRGXgwzbLgKk9PJpn6JGK1TU91hZe_VsTszngLOh7Q,1570
|
123
|
+
ormlambda/sql/functions/sum.py,sha256=_TN8SitDDBVD6VlsHZH3RpmiE5hkFrGGgC3tuEctKjk,1614
|
124
|
+
ormlambda/sql/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
125
|
+
ormlambda/sql/sqltypes.py,sha256=-YyzA-gPTnARoK29bMS6R3GCNvD4LTKvGH1Ev6YfUEY,14207
|
126
|
+
ormlambda/sql/table/__init__.py,sha256=LLZcMLjwFxgBCPhdm5UQYYZDIbtYWCKPO9CbcXsy5zI,50
|
127
|
+
ormlambda/sql/table/fields.py,sha256=ovNR3bJ473aKW-2NhbKr0iJlVpgW06jurHLob2IyZU8,2116
|
128
|
+
ormlambda/sql/table/table.py,sha256=riorLGKSX-Va5jMVXi6gbqebhNM2ALmPx6xIx4FHW3Y,6328
|
129
|
+
ormlambda/sql/table/table_constructor.py,sha256=c3Z-1El0onSClYBmAatoUBYUOT70tITVqtsDJMxZ9QU,1092
|
130
|
+
ormlambda/sql/type_api.py,sha256=FdEUBpdPbHIag--OU3mHY8vxMqyyzTMYygDBCUvGlcU,980
|
131
|
+
ormlambda/sql/types.py,sha256=lQxC5gbhDPRckGSRJZ4rYSZr-XUvIMMH8WfkN1wtM1g,844
|
132
|
+
ormlambda/sql/visitors.py,sha256=FJdnaiF86xK699Kq1qfHFSPtmeVsDX_PaUNHAoP8Tck,1967
|
133
|
+
ormlambda/statements/__init__.py,sha256=kmd5K0dXiLQ2xTYlhd2yXeG2l955RtpDkrAIkZlfad8,148
|
134
|
+
ormlambda/statements/base_statement.py,sha256=Dw89C2-eSwtuNc8UqzQMkoVuykf0gIWyA81YoXu6CQQ,4985
|
135
|
+
ormlambda/statements/interfaces/IStatements.py,sha256=c4GLGWEUlmi2u5wcnHLLLhLzoP4PmJnU16gciEVGu48,12883
|
136
|
+
ormlambda/statements/interfaces/__init__.py,sha256=a3RyTNVA7DwWMqvVi7gFYP4MArdU-RUYixJcxfc79HY,76
|
137
|
+
ormlambda/statements/query_builder.py,sha256=xb_idOh7sZJweBMPwG7Ow1Sl6toNkEBWPEzUcr1XdjU,5851
|
138
|
+
ormlambda/statements/statements.py,sha256=d5JjgH2UB08Y4M-aoARx-eC0l6J2HJmszhNZmqeOJ2Q,12690
|
139
|
+
ormlambda/statements/types.py,sha256=wNxgXOlL8zBT9PtVgDSnEZFmZdNAJhSzxsR9QLMzO0A,1873
|
140
|
+
ormlambda/types/__init__.py,sha256=xVFaIMcfJvbbXs8BAvmBh8FwSiLn2R6yjZs9o-h08XM,323
|
141
|
+
ormlambda/types/metadata.py,sha256=93eJItdVDOItf7YRJUVmN_m79WLa3Ge6I414ewYnKeM,624
|
142
|
+
ormlambda/util/__init__.py,sha256=PPwBGABqLG8VReokTt1pMLP3WKRPjVL3wFu7oGwnqSk,2845
|
143
|
+
ormlambda/util/module_tree/__init__.py,sha256=LNQtqkwO1ul49Th3aHAIiyt0Wt899GmXCc44Uz1eDyY,53
|
144
|
+
ormlambda/util/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkjptDbK3IugXm8iU,1425
|
145
|
+
ormlambda/util/module_tree/dynamic_module.py,sha256=SQ1FZW2Es5CdACD0VS8v_UZQTuFYbUWs6diAtMbKMoA,8699
|
146
|
+
ormlambda/util/plugin_loader.py,sha256=p6WLn-MF1bQd2i2GHy98WQjNKmbQdqIUyTFIcBIHC5M,1034
|
147
|
+
ormlambda/util/typing.py,sha256=Z7irz53ui0hoFnJTe06NX4JPl60_thgdjJIxh5gjGGk,169
|
148
|
+
ormlambda-3.34.0.dist-info/AUTHORS,sha256=uWpOHaCPTOLbVkk5x9McoLwbgzSeCg7yILeDRyMGWGM,606
|
149
|
+
ormlambda-3.34.0.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
|
150
|
+
ormlambda-3.34.0.dist-info/METADATA,sha256=Txg7W3AOTMVHGnKZPajK1d12uWupCfW7TmSKu7xbX0w,13377
|
151
|
+
ormlambda-3.34.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
152
|
+
ormlambda-3.34.0.dist-info/RECORD,,
|
ormlambda/components/__init__.py
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
from abc import abstractmethod
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
if TYPE_CHECKING:
|
6
|
-
from ormlambda import Table, IRepositoryBase
|
7
|
-
from ormlambda.common.abstract_classes import NonQueryBase
|
8
|
-
|
9
|
-
from .IDelete import IDelete
|
10
|
-
|
11
|
-
|
12
|
-
class DeleteQueryBase[T: Table, TRepo: IRepositoryBase](NonQueryBase[T, TRepo], IDelete[T]):
|
13
|
-
def __init__(self, model: T, repository: TRepo) -> None:
|
14
|
-
super().__init__(model, repository)
|
15
|
-
|
16
|
-
@abstractmethod
|
17
|
-
def delete(self, instances: T | list[T]) -> None: ...
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
from abc import abstractmethod
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
if TYPE_CHECKING:
|
6
|
-
from ormlambda import Table
|
7
|
-
from ormlambda.repository import IRepositoryBase
|
8
|
-
|
9
|
-
from ormlambda.common.abstract_classes import NonQueryBase
|
10
|
-
from .IInsert import IInsert
|
11
|
-
|
12
|
-
|
13
|
-
class InsertQueryBase[T: Table, TRepo: IRepositoryBase](NonQueryBase[T, TRepo], IInsert[T]):
|
14
|
-
def __init__(self, model: T, repository: TRepo) -> None:
|
15
|
-
super().__init__(model, repository)
|
16
|
-
|
17
|
-
@abstractmethod
|
18
|
-
def insert(self, instances: T | list[T]) -> None: ...
|
19
|
-
|
20
|
-
@property
|
21
|
-
@abstractmethod
|
22
|
-
def CLAUSE(self) -> str: ...
|
23
|
-
|
24
|
-
@abstractmethod
|
25
|
-
def execute(self) -> None: ...
|
@@ -1 +0,0 @@
|
|
1
|
-
from .ISelect import ISelect # noqa: F401
|
@@ -1,29 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
from abc import abstractmethod
|
3
|
-
from typing import Any, Optional, TYPE_CHECKING
|
4
|
-
|
5
|
-
from ormlambda.common.abstract_classes import NonQueryBase
|
6
|
-
from ormlambda.databases.my_sql.clauses.where import Where
|
7
|
-
|
8
|
-
if TYPE_CHECKING:
|
9
|
-
from ormlambda.repository import IRepositoryBase
|
10
|
-
from ormlambda import Table
|
11
|
-
|
12
|
-
from .IUpdate import IUpdate
|
13
|
-
|
14
|
-
|
15
|
-
class UpdateQueryBase[T: Table, TRepo: IRepositoryBase](NonQueryBase[T, TRepo], IUpdate):
|
16
|
-
def __init__(self, model: T, repository: TRepo, where: list[Where] = list[Where]) -> None:
|
17
|
-
super().__init__(model, repository)
|
18
|
-
self._where: Optional[list[Where]] = where
|
19
|
-
|
20
|
-
@abstractmethod
|
21
|
-
def update(self, dicc: dict[str | property, Any]) -> None:
|
22
|
-
return super().update(dicc)
|
23
|
-
|
24
|
-
@property
|
25
|
-
@abstractmethod
|
26
|
-
def CLAUSE(self) -> str: ...
|
27
|
-
|
28
|
-
@abstractmethod
|
29
|
-
def execute(self) -> None: ...
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
from abc import abstractmethod
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
if TYPE_CHECKING:
|
6
|
-
from ormlambda.repository import IRepositoryBase
|
7
|
-
from ormlambda import Table
|
8
|
-
|
9
|
-
from ormlambda.common.abstract_classes import NonQueryBase
|
10
|
-
from .IUpsert import IUpsert
|
11
|
-
|
12
|
-
|
13
|
-
class UpsertQueryBase[T: Table, TRepo: IRepositoryBase](NonQueryBase[T, TRepo], IUpsert[T]):
|
14
|
-
def __init__(self, model: T, repository: TRepo) -> None:
|
15
|
-
super().__init__(model, repository)
|
16
|
-
|
17
|
-
@abstractmethod
|
18
|
-
def upsert(self, instances: T | list[T]) -> None: ...
|
19
|
-
|
20
|
-
@property
|
21
|
-
@abstractmethod
|
22
|
-
def CLAUSE(self) -> str: ...
|
23
|
-
|
24
|
-
@abstractmethod
|
25
|
-
def execute(self) -> None: ...
|
ormlambda/databases/__init__.py
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from typing import Optional, get_args
|
4
|
-
from ormlambda.caster import BaseCaster
|
5
|
-
from ormlambda.caster import ICaster
|
6
|
-
|
7
|
-
|
8
|
-
from .types import StringCaster, IntegerCaster, FloatCaster, PointCaster, NoneTypeCaster, DatetimeCaster, BytesCaster, IterableCaster
|
9
|
-
|
10
|
-
from shapely import Point
|
11
|
-
from types import NoneType
|
12
|
-
from datetime import datetime
|
13
|
-
|
14
|
-
|
15
|
-
class MySQLCaster(ICaster):
|
16
|
-
@classmethod
|
17
|
-
def CASTER_SELECTOR(cls):
|
18
|
-
return {
|
19
|
-
str: StringCaster,
|
20
|
-
int: IntegerCaster,
|
21
|
-
float: FloatCaster,
|
22
|
-
Point: PointCaster,
|
23
|
-
NoneType: NoneTypeCaster,
|
24
|
-
datetime: DatetimeCaster,
|
25
|
-
bytes: BytesCaster,
|
26
|
-
bytearray: BytesCaster,
|
27
|
-
tuple: IterableCaster,
|
28
|
-
list: IterableCaster,
|
29
|
-
}
|
30
|
-
|
31
|
-
@classmethod
|
32
|
-
def cast[TProp, TType](cls, value: TProp, type_value: Optional[TType] = None) -> BaseCaster[TProp, TType]:
|
33
|
-
if len(args := get_args(type_value)) > 1:
|
34
|
-
args = [x for x in args if x != NoneType]
|
35
|
-
|
36
|
-
type_value = args[0]
|
37
|
-
|
38
|
-
column_type = type_value if type_value else type(value)
|
39
|
-
return cls.CASTER_SELECTOR()[column_type](value, column_type)
|
@@ -1,20 +0,0 @@
|
|
1
|
-
from .create_database import CreateDatabase as CreateDatabase
|
2
|
-
from .create_database import TypeExists as TypeExists
|
3
|
-
from .delete import DeleteQuery as DeleteQuery
|
4
|
-
from .drop_database import DropDatabase as DropDatabase
|
5
|
-
from .drop_table import DropTable as DropTable
|
6
|
-
from .insert import InsertQuery as InsertQuery
|
7
|
-
from .joins import JoinSelector as JoinSelector
|
8
|
-
from .joins import JoinType as JoinType
|
9
|
-
from .limit import Limit as Limit
|
10
|
-
from .offset import Offset as Offset
|
11
|
-
from .order import Order as Order
|
12
|
-
from .update import UpdateQuery as UpdateQuery
|
13
|
-
from .upsert import UpsertQuery as UpsertQuery
|
14
|
-
from .where import Where as Where
|
15
|
-
from .having import Having as Having
|
16
|
-
from .count import Count as Count
|
17
|
-
from .group_by import GroupBy as GroupBy
|
18
|
-
from .alias import Alias as Alias
|
19
|
-
from .ST_AsText import ST_AsText as ST_AsText
|
20
|
-
from .select import Select as Select
|
@@ -1,35 +0,0 @@
|
|
1
|
-
from typing import Literal, override
|
2
|
-
from mysql.connector import errorcode, errors
|
3
|
-
|
4
|
-
from ormlambda.repository import BaseRepository
|
5
|
-
|
6
|
-
TypeExists = Literal["fail", "replace", "append"]
|
7
|
-
|
8
|
-
|
9
|
-
class CreateDatabase:
|
10
|
-
def __init__(self, repository: BaseRepository) -> None:
|
11
|
-
self._repository: BaseRepository = repository
|
12
|
-
|
13
|
-
@override
|
14
|
-
@property
|
15
|
-
def CLAUSE(self) -> str:
|
16
|
-
return "CREATE DATABASE"
|
17
|
-
|
18
|
-
@override
|
19
|
-
def execute(self, name: str, if_exists: TypeExists = "fail") -> None:
|
20
|
-
if self._repository.database_exists(name):
|
21
|
-
if if_exists == "replace":
|
22
|
-
self._repository.drop_database(name)
|
23
|
-
elif if_exists == "fail":
|
24
|
-
raise errors.DatabaseError(msg=f"Database '{name}' already exists", errno=errorcode.ER_DB_CREATE_EXISTS)
|
25
|
-
elif if_exists == "append":
|
26
|
-
counter: int = 0
|
27
|
-
char: str = ""
|
28
|
-
while self._repository.database_exists(name + char):
|
29
|
-
counter += 1
|
30
|
-
char = f"_{counter}"
|
31
|
-
name += char
|
32
|
-
|
33
|
-
query = f"{self.CLAUSE} {name} DEFAULT CHARACTER SET 'utf8'"
|
34
|
-
self._repository.execute(query)
|
35
|
-
return None
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from typing import override
|
2
|
-
|
3
|
-
from ormlambda.repository import IRepositoryBase
|
4
|
-
|
5
|
-
|
6
|
-
class DropDatabase:
|
7
|
-
def __init__(self, repository: IRepositoryBase) -> None:
|
8
|
-
self._repository: IRepositoryBase = repository
|
9
|
-
|
10
|
-
@override
|
11
|
-
def execute(self, name: str) -> None:
|
12
|
-
return self._repository.execute(f"{self.CLAUSE} {name}")
|
13
|
-
|
14
|
-
@override
|
15
|
-
@property
|
16
|
-
def CLAUSE(self) -> str:
|
17
|
-
return "DROP DATABASE IF EXISTS"
|
@@ -1,23 +0,0 @@
|
|
1
|
-
from typing import Literal, override
|
2
|
-
|
3
|
-
from ormlambda.repository import IRepositoryBase
|
4
|
-
|
5
|
-
from mysql.connector import MySQLConnection
|
6
|
-
|
7
|
-
TypeExists = Literal["fail", "replace", "append"]
|
8
|
-
|
9
|
-
|
10
|
-
class DropTable:
|
11
|
-
def __init__(self, repository: IRepositoryBase) -> None:
|
12
|
-
self._repository: IRepositoryBase = repository
|
13
|
-
|
14
|
-
@override
|
15
|
-
def execute(self, name: str = None) -> None:
|
16
|
-
query = rf"{self.CLAUSE} {name}"
|
17
|
-
self._repository.execute(query)
|
18
|
-
return None
|
19
|
-
|
20
|
-
@property
|
21
|
-
@override
|
22
|
-
def CLAUSE(self) -> str:
|
23
|
-
return "DROP TABLE"
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import typing as tp
|
2
|
-
from ormlambda import Table
|
3
|
-
from ormlambda.sql.clause_info.clause_info import AggregateFunctionBase
|
4
|
-
from ormlambda.sql.clause_info.clause_info_context import ClauseInfoContext
|
5
|
-
from ormlambda.sql.types import ColumnType
|
6
|
-
|
7
|
-
|
8
|
-
class GroupBy[T: tp.Type[Table], *Ts, TProp](AggregateFunctionBase):
|
9
|
-
@classmethod
|
10
|
-
def FUNCTION_NAME(self) -> str:
|
11
|
-
return "GROUP BY"
|
12
|
-
|
13
|
-
def __init__(
|
14
|
-
self,
|
15
|
-
column: ColumnType,
|
16
|
-
context: ClauseInfoContext,
|
17
|
-
**kwargs,
|
18
|
-
):
|
19
|
-
super().__init__(
|
20
|
-
table=column.table,
|
21
|
-
column=column,
|
22
|
-
alias_table=None,
|
23
|
-
alias_clause=None,
|
24
|
-
context=context,
|
25
|
-
**kwargs,
|
26
|
-
)
|
27
|
-
|
28
|
-
@property
|
29
|
-
def query(self) -> str:
|
30
|
-
column = self._create_query()
|
31
|
-
return f"{self.FUNCTION_NAME()} {column}"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from typing import override
|
2
|
-
|
3
|
-
from ormlambda.common.interfaces.IQueryCommand import IQuery
|
4
|
-
|
5
|
-
|
6
|
-
class Limit(IQuery):
|
7
|
-
LIMIT = "LIMIT"
|
8
|
-
|
9
|
-
def __init__(self, number: int) -> None:
|
10
|
-
if not isinstance(number, int):
|
11
|
-
raise ValueError
|
12
|
-
self._number: int = number
|
13
|
-
|
14
|
-
@override
|
15
|
-
@property
|
16
|
-
def query(self) -> str:
|
17
|
-
return f"{self.LIMIT} {self._number}"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from typing import override
|
2
|
-
|
3
|
-
from ormlambda.common.interfaces.IQueryCommand import IQuery
|
4
|
-
|
5
|
-
|
6
|
-
class Offset(IQuery):
|
7
|
-
OFFSET = "OFFSET"
|
8
|
-
|
9
|
-
def __init__(self, number: int) -> None:
|
10
|
-
if not isinstance(number, int):
|
11
|
-
raise ValueError
|
12
|
-
self._number: int = number
|
13
|
-
|
14
|
-
@override
|
15
|
-
@property
|
16
|
-
def query(self) -> str:
|
17
|
-
return f"{self.OFFSET} {self._number}"
|
@@ -1 +0,0 @@
|
|
1
|
-
from .repository import MySQLRepository # noqa: F401
|