sql-blocks 1.2025.630__py3-none-any.whl → 1.2025.702__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.
- sql_blocks/sql_blocks.py +20 -11
- {sql_blocks-1.2025.630.dist-info → sql_blocks-1.2025.702.dist-info}/METADATA +1 -1
- sql_blocks-1.2025.702.dist-info/RECORD +7 -0
- sql_blocks-1.2025.630.dist-info/RECORD +0 -7
- {sql_blocks-1.2025.630.dist-info → sql_blocks-1.2025.702.dist-info}/LICENSE +0 -0
- {sql_blocks-1.2025.630.dist-info → sql_blocks-1.2025.702.dist-info}/WHEEL +0 -0
- {sql_blocks-1.2025.630.dist-info → sql_blocks-1.2025.702.dist-info}/top_level.txt +0 -0
sql_blocks/sql_blocks.py
CHANGED
@@ -399,15 +399,15 @@ class Frame:
|
|
399
399
|
keywords = ''
|
400
400
|
for field, obj in args.items():
|
401
401
|
is_valid = any([
|
402
|
-
obj is OrderBy,
|
402
|
+
obj is OrderBy, obj is DescOrderBy,
|
403
403
|
obj is Partition,
|
404
404
|
isinstance(obj, Rows),
|
405
405
|
])
|
406
406
|
if not is_valid:
|
407
407
|
continue
|
408
|
-
keywords += '{}{}
|
408
|
+
keywords += '{}{}'.format(
|
409
409
|
'\n\t\t' if self.break_lines else ' ',
|
410
|
-
obj.cls_to_str(
|
410
|
+
obj.cls_to_str(field if field != '_' else '')
|
411
411
|
)
|
412
412
|
if keywords and self.break_lines:
|
413
413
|
keywords += '\n\t'
|
@@ -774,13 +774,18 @@ class If(Code, Frame):
|
|
774
774
|
self.field = field
|
775
775
|
self.condition = condition
|
776
776
|
self.func_class = func_class
|
777
|
+
self.pattern = ''
|
777
778
|
super().__init__()
|
778
779
|
|
779
780
|
def format(self, name: str, main: SQLObject) -> str:
|
780
|
-
return '{func}({param})'.format(
|
781
|
+
return '{func}({param}){over}'.format(
|
781
782
|
func=self.func_class.__name__,
|
782
|
-
param=Case(self.field).when(self.condition, f'={name}').else_value(0)
|
783
|
+
param=Case(self.field).when(self.condition, f'={name}').else_value(0),
|
784
|
+
over=self.pattern
|
783
785
|
)
|
786
|
+
|
787
|
+
def get_pattern(self) -> str:
|
788
|
+
return ''
|
784
789
|
|
785
790
|
|
786
791
|
class Options:
|
@@ -881,7 +886,7 @@ class Rows:
|
|
881
886
|
def __init__(self, *rows: list[Row]):
|
882
887
|
self.rows = rows
|
883
888
|
|
884
|
-
def cls_to_str(self) -> str:
|
889
|
+
def cls_to_str(self, field: str='') -> str:
|
885
890
|
return 'ROWS {}{}'.format(
|
886
891
|
'BETWEEN ' if len(self.rows) > 1 else '',
|
887
892
|
' AND '.join(str(row) for row in self.rows)
|
@@ -894,6 +899,11 @@ class DescOrderBy:
|
|
894
899
|
name = Clause.format(name, main)
|
895
900
|
main.values.setdefault(ORDER_BY, []).append(name + SortType.DESC.value)
|
896
901
|
|
902
|
+
@classmethod
|
903
|
+
def cls_to_str(cls, field: str='') -> str:
|
904
|
+
return f"{ORDER_BY} {field} DESC"
|
905
|
+
|
906
|
+
|
897
907
|
class OrderBy(Clause):
|
898
908
|
sort: SortType = SortType.ASC
|
899
909
|
DESC = DescOrderBy
|
@@ -918,14 +928,13 @@ class OrderBy(Clause):
|
|
918
928
|
return super().format(name, main)
|
919
929
|
|
920
930
|
@classmethod
|
921
|
-
def cls_to_str(cls) -> str:
|
922
|
-
return ORDER_BY
|
931
|
+
def cls_to_str(cls, field: str='') -> str:
|
932
|
+
return f"{ORDER_BY} {field}"
|
923
933
|
|
924
|
-
PARTITION_BY = 'PARTITION BY'
|
925
934
|
class Partition:
|
926
935
|
@classmethod
|
927
|
-
def cls_to_str(cls) -> str:
|
928
|
-
return
|
936
|
+
def cls_to_str(cls, field: str) -> str:
|
937
|
+
return f'PARTITION BY {field}'
|
929
938
|
|
930
939
|
|
931
940
|
class GroupBy(Clause):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sql_blocks
|
3
|
-
Version: 1.2025.
|
3
|
+
Version: 1.2025.702
|
4
4
|
Summary: Allows you to create objects for parts of SQL query commands. Also to combine these objects by joining them, adding or removing parts...
|
5
5
|
Home-page: https://github.com/julio-cascalles/sql_blocks
|
6
6
|
Author: Júlio Cascalles
|
@@ -0,0 +1,7 @@
|
|
1
|
+
sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
|
2
|
+
sql_blocks/sql_blocks.py,sha256=O5PNPcmFsfAT2gld4c5oy9PHdHW7NIJV-AOUJ68eCWc,79088
|
3
|
+
sql_blocks-1.2025.702.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
+
sql_blocks-1.2025.702.dist-info/METADATA,sha256=vbozm9bhdMoLPlT4juultOhh9ujoOZm-P6kIYngPHSQ,23646
|
5
|
+
sql_blocks-1.2025.702.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
sql_blocks-1.2025.702.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
+
sql_blocks-1.2025.702.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
|
2
|
-
sql_blocks/sql_blocks.py,sha256=fYdDBx9s8nHRn5PGfoj1e4PYN0oDmg9F-xic6ikBzVg,78800
|
3
|
-
sql_blocks-1.2025.630.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
-
sql_blocks-1.2025.630.dist-info/METADATA,sha256=x29eSZ8nH4eZTk-tHnfGVo8CqhsJIEPJD2ApqUU2I4U,23646
|
5
|
-
sql_blocks-1.2025.630.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
sql_blocks-1.2025.630.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
-
sql_blocks-1.2025.630.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|