sql-blocks 0.1.2__tar.gz → 0.1.3__tar.gz
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-0.1.2/sql_blocks.egg-info → sql_blocks-0.1.3}/PKG-INFO +1 -1
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/pyproject.toml +1 -1
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/setup.py +1 -1
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/sql_blocks/sql_blocks.py +3 -16
- {sql_blocks-0.1.2 → sql_blocks-0.1.3/sql_blocks.egg-info}/PKG-INFO +1 -1
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/LICENSE +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/README.md +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/setup.cfg +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/sql_blocks/__init__.py +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/sql_blocks.egg-info/SOURCES.txt +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/sql_blocks.egg-info/dependency_links.txt +0 -0
- {sql_blocks-0.1.2 → sql_blocks-0.1.3}/sql_blocks.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sql_blocks
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
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
|
@@ -5,10 +5,10 @@ import re
|
|
5
5
|
PATTERN_PREFIX = '([^0-9 ]+[.])'
|
6
6
|
PATTERN_SUFFIX = '( [A-Za-z_]+)'
|
7
7
|
SUFFIX_AND_PRE = f'{PATTERN_SUFFIX}|{PATTERN_PREFIX}'
|
8
|
-
|
8
|
+
DISTINCT_PREFX = f'(DISTINCT|distinct)|{PATTERN_PREFIX}'
|
9
9
|
|
10
10
|
KEYWORD = {
|
11
|
-
'SELECT': (',{}', 'SELECT *',
|
11
|
+
'SELECT': (',{}', 'SELECT *', DISTINCT_PREFX),
|
12
12
|
'FROM': ('{}', '', PATTERN_SUFFIX),
|
13
13
|
'WHERE': ('{}AND ', '', ''),
|
14
14
|
'GROUP BY': (',{}', '', SUFFIX_AND_PRE),
|
@@ -74,6 +74,7 @@ class SQLObject:
|
|
74
74
|
if symmetrical:
|
75
75
|
fld = fld.lower()
|
76
76
|
return fld.strip()
|
77
|
+
# if key == SELECT and re.search(' as | AS ', fld)
|
77
78
|
pattern = KEYWORD[key][2]
|
78
79
|
if key == WHERE and symmetrical:
|
79
80
|
pattern = f'{PATTERN_PREFIX}| '
|
@@ -405,8 +406,6 @@ class Select(SQLObject):
|
|
405
406
|
self.break_lines = True
|
406
407
|
|
407
408
|
def update_values(self, key: str, new_values: list):
|
408
|
-
if key == SELECT:
|
409
|
-
new_values = [re.split(' as | AS ', val)[-1] for val in new_values]
|
410
409
|
for value in self.diff(key, new_values):
|
411
410
|
self.values.setdefault(key, []).append(value)
|
412
411
|
|
@@ -639,15 +638,3 @@ class RuleDateFuncReplace(Rule):
|
|
639
638
|
temp = Select(f'{target.table_name} {target.alias}')
|
640
639
|
Between(f'{year}-01-01', f'{year}-12-31').add(field, temp)
|
641
640
|
target.values[WHERE][i] = ' AND '.join(temp.values[WHERE])
|
642
|
-
|
643
|
-
|
644
|
-
if __name__ == "__main__":
|
645
|
-
query = Select(
|
646
|
-
'Cast c',
|
647
|
-
actor_id=Select(
|
648
|
-
'Actor a',
|
649
|
-
name=NamedField('actors_name'),
|
650
|
-
id=PrimaryKey
|
651
|
-
)
|
652
|
-
)
|
653
|
-
print(query)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sql_blocks
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|