sql-blocks 1.25.30011511__py3-none-any.whl → 1.25.30011644__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
@@ -441,11 +441,11 @@ class Where:
441
441
  return cls.__constructor('=', value)
442
442
 
443
443
  @classmethod
444
- def contains(cls, content: str, pos: Position = Position.Middle):
444
+ def contains(cls, text: str, pos: Position = Position.Middle):
445
445
  return cls(
446
446
  "LIKE '{}{}{}'".format(
447
447
  '%' if pos != Position.StartsWith else '',
448
- content,
448
+ text,
449
449
  '%' if pos != Position.EndsWith else ''
450
450
  )
451
451
  )
@@ -524,7 +524,10 @@ eq, contains, gt, gte, lt, lte, is_null, inside = (
524
524
  getattr(Where, method) for method in
525
525
  ('eq', 'contains', 'gt', 'gte', 'lt', 'lte', 'is_null', 'inside')
526
526
  )
527
- startswith, endswith = [lambda x: contains(x, pos) for pos in Position if pos.value]
527
+ startswith, endswith = [
528
+ lambda x: contains(x, Position.StartsWith),
529
+ lambda x: contains(x, Position.EndsWith)
530
+ ]
528
531
 
529
532
 
530
533
  class Not(Where):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sql_blocks
3
- Version: 1.25.30011511
3
+ Version: 1.25.30011644
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
@@ -153,6 +153,35 @@ FROM
153
153
  JOIN Cast c ON (a.cast = c.id)
154
154
  ```
155
155
 
156
+ ---
157
+ **5.1 Multiple tables without JOIN**
158
+ > Warning: This is **NOT** recommended! ⛔
159
+
160
+
161
+ #### Example:
162
+ singer = Select(
163
+ "Singer artist", id=PrimaryKey,
164
+ name=NamedField('artist_name')
165
+ )
166
+ album = Select (
167
+ "Album album",
168
+ name=NamedField('album_name'),
169
+ artist_id=Where.join(singer), # <===== 👀
170
+ )
171
+ **>> print(query)**
172
+
173
+ SELECT
174
+ album.name as album_name,
175
+ artist.name as artist_name,
176
+ album.year_recorded
177
+ FROM
178
+ 'sql_blocks/music/data/Album.csv' album
179
+ ,'sql_blocks/music/data/Singer.csv' artist
180
+ WHERE
181
+ (album.artist_id = artist.id)
182
+
183
+
184
+
156
185
  ---
157
186
  ### 6 - The reverse process (parse):
158
187
  ```
@@ -0,0 +1,7 @@
1
+ sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
2
+ sql_blocks/sql_blocks.py,sha256=2R4VoSZUHTb1gSZwKjtNfkjxeH8G1dKYuDpuKv-UP7E,54430
3
+ sql_blocks-1.25.30011644.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
4
+ sql_blocks-1.25.30011644.dist-info/METADATA,sha256=2Q1naQygxXqw87DTc70LyLjs8uWK95v0CWu5B9qHLlQ,16884
5
+ sql_blocks-1.25.30011644.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ sql_blocks-1.25.30011644.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
7
+ sql_blocks-1.25.30011644.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- sql_blocks/__init__.py,sha256=5ItzGCyqqa6kwY8wvF9kapyHsAiWJ7KEXCcC-OtdXKg,37
2
- sql_blocks/sql_blocks.py,sha256=fTEX1TEkjr-uUg_aLVmkwVM5Ul3UQyvsW6Vw7z_TCQQ,54398
3
- sql_blocks-1.25.30011511.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
4
- sql_blocks-1.25.30011511.dist-info/METADATA,sha256=Hqo-6uZ0zLVyhvw7H9E1Hc7vGT5Ny6Kjxy2nzTqIEn0,16187
5
- sql_blocks-1.25.30011511.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- sql_blocks-1.25.30011511.dist-info/top_level.txt,sha256=57AbUvUjYNy4m1EqDaU3WHeP-uyIAfV0n8GAUp1a1YQ,11
7
- sql_blocks-1.25.30011511.dist-info/RECORD,,