sql-blocks 1.25__py3-none-any.whl → 1.25.2__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 CHANGED
@@ -163,17 +163,19 @@ class Function:
163
163
 
164
164
  def As(self, field_alias: str, modifiers=None):
165
165
  if modifiers:
166
- for mod in TO_LIST(modifiers):
167
- self.extra[field_alias] = mod
166
+ self.extra[field_alias] = TO_LIST(modifiers)
168
167
  self.class_type = NamedField(field_alias)
169
168
  return self
170
169
 
171
170
  @classmethod
172
171
  def format(cls, name: str, main: SQLObject) -> str:
173
172
  obj = cls.get_instance()
174
- params = [
175
- Field.format(name, main)
176
- ] + obj.params
173
+ if name in '*_' and obj.params:
174
+ params = obj.params
175
+ else:
176
+ params = [
177
+ Field.format(name, main)
178
+ ] + obj.params
177
179
  return obj.pattern.format(
178
180
  cls.__name__,
179
181
  ', '.join(params)
@@ -1357,3 +1359,12 @@ def detect(text: str) -> Select:
1357
1359
  for query in query_list[1:]:
1358
1360
  result += query
1359
1361
  return result
1362
+
1363
+ if __name__ == "__main__":
1364
+ OrderBy.sort = SortType.DESC
1365
+ query = Select(
1366
+ 'order_Detail d',
1367
+ customer_id=GroupBy,
1368
+ _=Sum('d.unitPrice * d.quantity').As('total', OrderBy)
1369
+ )
1370
+ 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.2
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=R2xZsaKRd600rsZf0lzyXITALpZ3ZXBmwOADNpX1qUA,45798
3
+ sql_blocks-1.25.2.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
4
+ sql_blocks-1.25.2.dist-info/METADATA,sha256=NKLAHw43avYevBxxWhKBts8tOB2AaKETMp08dCoSAzQ,13423
5
+ sql_blocks-1.25.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ sql_blocks-1.25.2.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
7
+ sql_blocks-1.25.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
2
- sql_blocks/sql_blocks.py,sha256=QxopGbzRtBgG_9oAs1ovBATFplDqrzEFSLwyKbOL-W8,45499
3
- sql_blocks-1.25.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
4
- sql_blocks-1.25.dist-info/METADATA,sha256=cvHewfK05stZRHfWZeyIMMtKRjdOGxZN38o94JkVS-U,13421
5
- sql_blocks-1.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- sql_blocks-1.25.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
7
- sql_blocks-1.25.dist-info/RECORD,,