sql_fusion 1.2.1__tar.gz → 1.2.2__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_fusion-1.2.1 → sql_fusion-1.2.2}/PKG-INFO +22 -6
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/README.md +21 -5
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/pyproject.toml +1 -1
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/sets.py +2 -2
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/__init__.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/composite_table.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/operators.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/__init__.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/delete.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/insert.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/select.py +0 -0
- {sql_fusion-1.2.1 → sql_fusion-1.2.2}/src/sql_fusion/query/update.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sql_fusion
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python query builder with a focus on composability and reusability.
|
|
5
5
|
Author: Mastermind-U
|
|
6
6
|
Author-email: Mastermind-U <rex49513@gmail.com>
|
|
@@ -72,6 +72,22 @@ SQL Fusion is built for the middle ground:
|
|
|
72
72
|
|
|
73
73
|
In short, the goal is to keep the ergonomics of a lightweight builder while still covering the parts of SQL that matter in real applications.
|
|
74
74
|
|
|
75
|
+
### Why not SQLAlchemy ORM or Core?
|
|
76
|
+
|
|
77
|
+
SQLAlchemy is an excellent tool, but it is also a much heavier and more universal system:
|
|
78
|
+
|
|
79
|
+
- it brings a larger abstraction surface than this project needs
|
|
80
|
+
- it is optimized for a broad ORM and Core ecosystem, not only for a small SQL builder
|
|
81
|
+
- some connectors and databases still do not have first-class SQLAlchemy integrations, which can make adoption less straightforward in mixed environments
|
|
82
|
+
|
|
83
|
+
SQLAlchemy Core is closer to SQL Fusion than the full ORM, but it still carries more machinery than this project is meant to expose:
|
|
84
|
+
|
|
85
|
+
- it is part of a broader ecosystem with dialects, compilation layers, and extra conventions
|
|
86
|
+
- it can feel more verbose when you only want a small chainable builder
|
|
87
|
+
- some connectors and databases still do not have smooth SQLAlchemy Core support, so portability can depend on the backend
|
|
88
|
+
|
|
89
|
+
SQL Fusion is intentionally narrower so it can stay lightweight, easy to embed, and practical for DB-API style backends without extra complexity.
|
|
90
|
+
|
|
75
91
|
## What You Get
|
|
76
92
|
|
|
77
93
|
- `SELECT`, `INSERT`, `UPDATE`, and `DELETE` builders
|
|
@@ -409,9 +425,9 @@ query, params = select().from_(paid_orders).compile()
|
|
|
409
425
|
|
|
410
426
|
SQL Fusion supports compound queries through three small wrapper classes:
|
|
411
427
|
|
|
412
|
-
- `union(query1, query2,
|
|
413
|
-
- `intersect(
|
|
414
|
-
- `except_(
|
|
428
|
+
- `union(query1, query2, all_=False, by_name=False)`
|
|
429
|
+
- `intersect(query1, query2, all_=False)`
|
|
430
|
+
- `except_(query1, query2, all_=False)`
|
|
415
431
|
|
|
416
432
|
Each builder accepts two query objects and returns a new query that compiles to
|
|
417
433
|
the matching SQL set operation.
|
|
@@ -435,7 +451,7 @@ query, params = union(active_users, archived_active_users).compile()
|
|
|
435
451
|
Use `all=True` for `UNION ALL`:
|
|
436
452
|
|
|
437
453
|
```python
|
|
438
|
-
query, params = union(active_users, archived_active_users,
|
|
454
|
+
query, params = union(active_users, archived_active_users, all_=True).compile()
|
|
439
455
|
```
|
|
440
456
|
|
|
441
457
|
Use `by_name=True` when the two result sets expose the same logical columns in
|
|
@@ -445,7 +461,7 @@ different orders:
|
|
|
445
461
|
left = select(users.id, users.name).from_(users)
|
|
446
462
|
right = select(archived_users.name, archived_users.id).from_(archived_users)
|
|
447
463
|
|
|
448
|
-
query, params = union(left, right,
|
|
464
|
+
query, params = union(left, right, all_=True, by_name=True).compile()
|
|
449
465
|
```
|
|
450
466
|
|
|
451
467
|
### `intersect(...)`
|
|
@@ -58,6 +58,22 @@ SQL Fusion is built for the middle ground:
|
|
|
58
58
|
|
|
59
59
|
In short, the goal is to keep the ergonomics of a lightweight builder while still covering the parts of SQL that matter in real applications.
|
|
60
60
|
|
|
61
|
+
### Why not SQLAlchemy ORM or Core?
|
|
62
|
+
|
|
63
|
+
SQLAlchemy is an excellent tool, but it is also a much heavier and more universal system:
|
|
64
|
+
|
|
65
|
+
- it brings a larger abstraction surface than this project needs
|
|
66
|
+
- it is optimized for a broad ORM and Core ecosystem, not only for a small SQL builder
|
|
67
|
+
- some connectors and databases still do not have first-class SQLAlchemy integrations, which can make adoption less straightforward in mixed environments
|
|
68
|
+
|
|
69
|
+
SQLAlchemy Core is closer to SQL Fusion than the full ORM, but it still carries more machinery than this project is meant to expose:
|
|
70
|
+
|
|
71
|
+
- it is part of a broader ecosystem with dialects, compilation layers, and extra conventions
|
|
72
|
+
- it can feel more verbose when you only want a small chainable builder
|
|
73
|
+
- some connectors and databases still do not have smooth SQLAlchemy Core support, so portability can depend on the backend
|
|
74
|
+
|
|
75
|
+
SQL Fusion is intentionally narrower so it can stay lightweight, easy to embed, and practical for DB-API style backends without extra complexity.
|
|
76
|
+
|
|
61
77
|
## What You Get
|
|
62
78
|
|
|
63
79
|
- `SELECT`, `INSERT`, `UPDATE`, and `DELETE` builders
|
|
@@ -395,9 +411,9 @@ query, params = select().from_(paid_orders).compile()
|
|
|
395
411
|
|
|
396
412
|
SQL Fusion supports compound queries through three small wrapper classes:
|
|
397
413
|
|
|
398
|
-
- `union(query1, query2,
|
|
399
|
-
- `intersect(
|
|
400
|
-
- `except_(
|
|
414
|
+
- `union(query1, query2, all_=False, by_name=False)`
|
|
415
|
+
- `intersect(query1, query2, all_=False)`
|
|
416
|
+
- `except_(query1, query2, all_=False)`
|
|
401
417
|
|
|
402
418
|
Each builder accepts two query objects and returns a new query that compiles to
|
|
403
419
|
the matching SQL set operation.
|
|
@@ -421,7 +437,7 @@ query, params = union(active_users, archived_active_users).compile()
|
|
|
421
437
|
Use `all=True` for `UNION ALL`:
|
|
422
438
|
|
|
423
439
|
```python
|
|
424
|
-
query, params = union(active_users, archived_active_users,
|
|
440
|
+
query, params = union(active_users, archived_active_users, all_=True).compile()
|
|
425
441
|
```
|
|
426
442
|
|
|
427
443
|
Use `by_name=True` when the two result sets expose the same logical columns in
|
|
@@ -431,7 +447,7 @@ different orders:
|
|
|
431
447
|
left = select(users.id, users.name).from_(users)
|
|
432
448
|
right = select(archived_users.name, archived_users.id).from_(archived_users)
|
|
433
449
|
|
|
434
|
-
query, params = union(left, right,
|
|
450
|
+
query, params = union(left, right, all_=True, by_name=True).compile()
|
|
435
451
|
```
|
|
436
452
|
|
|
437
453
|
### `intersect(...)`
|
|
@@ -57,11 +57,11 @@ class union(_set_operation):
|
|
|
57
57
|
self,
|
|
58
58
|
query1: AbstractQuery,
|
|
59
59
|
query2: AbstractQuery,
|
|
60
|
-
|
|
60
|
+
all_: bool = False,
|
|
61
61
|
by_name: bool = False,
|
|
62
62
|
) -> None:
|
|
63
63
|
super().__init__(query1, query2)
|
|
64
|
-
self._all =
|
|
64
|
+
self._all = all_
|
|
65
65
|
self._by_name = by_name
|
|
66
66
|
|
|
67
67
|
def _operator_sql(self) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|