sql-blocks 1.25.19011745__py3-none-any.whl → 1.25.19011849__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 +23 -10
- {sql_blocks-1.25.19011745.dist-info → sql_blocks-1.25.19011849.dist-info}/METADATA +1 -1
- sql_blocks-1.25.19011849.dist-info/RECORD +7 -0
- sql_blocks-1.25.19011745.dist-info/RECORD +0 -7
- {sql_blocks-1.25.19011745.dist-info → sql_blocks-1.25.19011849.dist-info}/LICENSE +0 -0
- {sql_blocks-1.25.19011745.dist-info → sql_blocks-1.25.19011849.dist-info}/WHEEL +0 -0
- {sql_blocks-1.25.19011745.dist-info → sql_blocks-1.25.19011849.dist-info}/top_level.txt +0 -0
sql_blocks/sql_blocks.py
CHANGED
@@ -566,7 +566,7 @@ class Clause:
|
|
566
566
|
found = re.findall(r'^_\d', name)
|
567
567
|
if found:
|
568
568
|
name = found[0].replace('_', '')
|
569
|
-
elif main.alias and not is_function():
|
569
|
+
elif '.' not in name and main.alias and not is_function():
|
570
570
|
name = f'{main.alias}.{name}'
|
571
571
|
return name
|
572
572
|
|
@@ -1008,8 +1008,11 @@ class SQLParser(Parser):
|
|
1008
1008
|
if not key in values:
|
1009
1009
|
continue
|
1010
1010
|
separator = self.class_type.get_separator(key)
|
1011
|
+
cls = {
|
1012
|
+
ORDER_BY: OrderBy, GROUP_BY: GroupBy
|
1013
|
+
}.get(key, Field)
|
1011
1014
|
obj.values[key] = [
|
1012
|
-
|
1015
|
+
cls.format(fld, obj)
|
1013
1016
|
for fld in re.split(separator, values[key])
|
1014
1017
|
if (fld != '*' and len(tables) == 1) or obj.match(fld, key)
|
1015
1018
|
]
|
@@ -1555,12 +1558,22 @@ def detect(text: str, join_queries: bool = True) -> Select:
|
|
1555
1558
|
|
1556
1559
|
|
1557
1560
|
if __name__ == '__main__':
|
1558
|
-
query = Select(
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
)
|
1561
|
+
# query = Select(
|
1562
|
+
# 'Tips t',
|
1563
|
+
# tip=[Field, Lag().over(day=OrderBy).As('last')],
|
1564
|
+
# diff=[
|
1565
|
+
# ExpressionField('Round(tip-last, 2) as {f}'),
|
1566
|
+
# Not.is_null()
|
1567
|
+
# ]
|
1568
|
+
# )
|
1569
|
+
p, c, a = Select.parse('''
|
1570
|
+
Professor(?nome="Júlio Cascalles", id)
|
1571
|
+
<- Curso@disciplina(professor, aluno) ->
|
1572
|
+
Aluno(id ^count$qtd_alunos)
|
1573
|
+
''', CypherParser)
|
1574
|
+
query = p + c + a
|
1575
|
+
print(query)
|
1576
|
+
print('------------------')
|
1577
|
+
query.optimize([RuleReplaceJoinBySubselect])
|
1578
|
+
# ==============================================
|
1566
1579
|
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.19011849
|
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=nMIOewFh6X7vC0UNKs4mdqz4F_gpCSvtF0oAkocEGHw,52542
|
3
|
+
sql_blocks-1.25.19011849.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
+
sql_blocks-1.25.19011849.dist-info/METADATA,sha256=jp-OY-e66KmW-tXSklUT3l5-01CX0jfCCPJ6iANNpSY,15031
|
5
|
+
sql_blocks-1.25.19011849.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
sql_blocks-1.25.19011849.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
+
sql_blocks-1.25.19011849.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
|
2
|
-
sql_blocks/sql_blocks.py,sha256=lPUpYOLHjvx84EVjlydJK03rm7qG1DWotRtqyldKqvo,52020
|
3
|
-
sql_blocks-1.25.19011745.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
4
|
-
sql_blocks-1.25.19011745.dist-info/METADATA,sha256=KPw30aPiITpjBHpfWU9yAuTtr8aQ5cW5cdIdzM4iD0k,15031
|
5
|
-
sql_blocks-1.25.19011745.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
sql_blocks-1.25.19011745.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
|
7
|
-
sql_blocks-1.25.19011745.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|