sql-blocks 1.25.313022106__py3-none-any.whl → 1.25.419021324__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 +8 -18
- {sql_blocks-1.25.313022106.dist-info → sql_blocks-1.25.419021324.dist-info}/METADATA +8 -2
- sql_blocks-1.25.419021324.dist-info/RECORD +7 -0
- sql_blocks-1.25.313022106.dist-info/RECORD +0 -7
- {sql_blocks-1.25.313022106.dist-info → sql_blocks-1.25.419021324.dist-info}/LICENSE +0 -0
- {sql_blocks-1.25.313022106.dist-info → sql_blocks-1.25.419021324.dist-info}/WHEEL +0 -0
- {sql_blocks-1.25.313022106.dist-info → sql_blocks-1.25.419021324.dist-info}/top_level.txt +0 -0
sql_blocks/sql_blocks.py
CHANGED
@@ -829,7 +829,7 @@ class QueryLanguage:
|
|
829
829
|
return self.join_with_tabs(values, ' AND ')
|
830
830
|
|
831
831
|
def sort_by(self, values: list) -> str:
|
832
|
-
return self.join_with_tabs(values)
|
832
|
+
return self.join_with_tabs(values, ',')
|
833
833
|
|
834
834
|
def set_group(self, values: list) -> str:
|
835
835
|
return self.join_with_tabs(values, ',')
|
@@ -1532,7 +1532,7 @@ class Select(SQLObject):
|
|
1532
1532
|
Recognizes if the field is from the current table
|
1533
1533
|
'''
|
1534
1534
|
if key in (ORDER_BY, GROUP_BY) and '.' not in field:
|
1535
|
-
return
|
1535
|
+
return self.has_named_field(field)
|
1536
1536
|
return re.findall(f'\b*{self.alias}[.]', field) != []
|
1537
1537
|
|
1538
1538
|
@classmethod
|
@@ -1798,21 +1798,11 @@ def detect(text: str, join_queries: bool = True, format: str='') -> Select | lis
|
|
1798
1798
|
return result
|
1799
1799
|
# ===========================================================================================//
|
1800
1800
|
|
1801
|
+
|
1801
1802
|
if __name__ == "__main__":
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
eq('E'), 1
|
1807
|
-
).else_value( -1 ),
|
1808
|
-
pessoa=Field
|
1809
|
-
)
|
1810
|
-
print(movimento)
|
1811
|
-
print('-'*50)
|
1812
|
-
cte = CTE('Ciclo C', [movimento])
|
1813
|
-
cte(
|
1814
|
-
pessoa=[GroupBy, Field],
|
1815
|
-
direcao=Having.sum(gt(0))
|
1803
|
+
query = Select(
|
1804
|
+
'Table T',
|
1805
|
+
name=[Field, OrderBy],
|
1806
|
+
value=[Field, OrderBy],
|
1816
1807
|
)
|
1817
|
-
print(
|
1818
|
-
print('='*50)
|
1808
|
+
print(query)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sql_blocks
|
3
|
-
Version: 1.25.
|
3
|
+
Version: 1.25.419021324
|
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
|
@@ -52,6 +52,12 @@ You can specify your own alias: `a = Select('Actor a')`
|
|
52
52
|
...should return:
|
53
53
|
**SELECT extract(year from due_date) as YEAR_ref...**
|
54
54
|
|
55
|
+
Possible tags in ExpressionField:
|
56
|
+
* {f} - The field name;
|
57
|
+
* {af} - The field name preceded by the table alias;
|
58
|
+
> Can be written as {a.f} or %
|
59
|
+
* {t} - The table name;
|
60
|
+
* {a} - Only the table alias.
|
55
61
|
---
|
56
62
|
|
57
63
|
### 3 - To set conditions, use **Where**:
|
@@ -450,7 +456,7 @@ WHERE
|
|
450
456
|
query = Select('post p')
|
451
457
|
query.add_fields(
|
452
458
|
'user_id, created_at',
|
453
|
-
|
459
|
+
[OrderBy, GroupBy]
|
454
460
|
)
|
455
461
|
```
|
456
462
|
...is the same as...
|
@@ -0,0 +1,7 @@
|
|
1
|
+
sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
|
2
|
+
sql_blocks/sql_blocks.py,sha256=AP5RXh5Lij_Z5PWuputOZX_ld-RnGir9FX916sGGsCA,60329
|
3
|
+
sql_blocks-1.25.419021324.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
+
sql_blocks-1.25.419021324.dist-info/METADATA,sha256=7UGdObqSmiYqjOyp9CW60iKcNQm4FklaQkukuTfPUr4,20708
|
5
|
+
sql_blocks-1.25.419021324.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
sql_blocks-1.25.419021324.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
+
sql_blocks-1.25.419021324.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
|
2
|
-
sql_blocks/sql_blocks.py,sha256=rJThLDIWJpyI-plCdfpG5UwZDpp_pEriUbw1GgXRs0U,60595
|
3
|
-
sql_blocks-1.25.313022106.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
-
sql_blocks-1.25.313022106.dist-info/METADATA,sha256=M9_xMMjLg9SYWM4m2ocomFow70Xu8eoqlBZ2BQdt3_4,20512
|
5
|
-
sql_blocks-1.25.313022106.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
sql_blocks-1.25.313022106.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
-
sql_blocks-1.25.313022106.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|