sql-blocks 1.25.419021324__py3-none-any.whl → 1.25.420021312__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
@@ -1720,6 +1720,8 @@ class RuleDateFuncReplace(Rule):
1720
1720
  @classmethod
1721
1721
  def apply(cls, target: Select):
1722
1722
  for i, condition in enumerate(target.values.get(WHERE, [])):
1723
+ if not '(' in condition:
1724
+ continue
1723
1725
  tokens = [
1724
1726
  t.strip() for t in cls.REGEX.split(condition) if t.strip()
1725
1727
  ]
@@ -1801,8 +1803,26 @@ def detect(text: str, join_queries: bool = True, format: str='') -> Select | lis
1801
1803
 
1802
1804
  if __name__ == "__main__":
1803
1805
  query = Select(
1804
- 'Table T',
1805
- name=[Field, OrderBy],
1806
- value=[Field, OrderBy],
1806
+ 'Matricula M',
1807
+ aluno_id=Select(
1808
+ 'Aluno A',
1809
+ nome=NamedField('nome_aluno'),
1810
+ id=PrimaryKey
1811
+ ),
1812
+ curso=Select(
1813
+ 'Curso C',
1814
+ nome=NamedField('nome_curso'),
1815
+ id=PrimaryKey
1816
+ )
1807
1817
  )
1818
+ print('='*50)
1819
+ print(query)
1820
+ print('-'*50)
1821
+ m, c, a = Select.parse( str(query) )
1822
+ m(inicio=[Not.gt('2024-11-15'), Field])
1823
+ query = m + a
1824
+ print(query)
1825
+ print('-'*50)
1826
+ query.optimize()
1808
1827
  print(query)
1828
+ print('='*50)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sql_blocks
3
- Version: 1.25.419021324
3
+ Version: 1.25.420021312
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=WkFmxphTnqT74MgGX6JCKLMRmxwDPGXdDmZ8DU-qObs,60834
3
+ sql_blocks-1.25.420021312.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
4
+ sql_blocks-1.25.420021312.dist-info/METADATA,sha256=qCiTXUBNpwkwBGWXLROxIVo2tz5XgLr5yLJeoYQKAmQ,20708
5
+ sql_blocks-1.25.420021312.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ sql_blocks-1.25.420021312.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
7
+ sql_blocks-1.25.420021312.dist-info/RECORD,,
@@ -1,7 +0,0 @@
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,,