velocity-python 0.0.92__py3-none-any.whl → 0.0.93__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.
Potentially problematic release.
This version of velocity-python might be problematic. Click here for more details.
- velocity/__init__.py +1 -1
- {velocity_python-0.0.92.dist-info → velocity_python-0.0.93.dist-info}/METADATA +30 -16
- {velocity_python-0.0.92.dist-info → velocity_python-0.0.93.dist-info}/RECORD +6 -6
- {velocity_python-0.0.92.dist-info → velocity_python-0.0.93.dist-info}/WHEEL +0 -0
- {velocity_python-0.0.92.dist-info → velocity_python-0.0.93.dist-info}/licenses/LICENSE +0 -0
- {velocity_python-0.0.92.dist-info → velocity_python-0.0.93.dist-info}/top_level.txt +0 -0
velocity/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: velocity-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.93
|
|
4
4
|
Summary: A rapid application development library for interfacing with data storage
|
|
5
5
|
Author-email: Velocity Team <contact@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -205,7 +205,7 @@ def update_user(tx):
|
|
|
205
205
|
# Bulk update
|
|
206
206
|
users.update(
|
|
207
207
|
{'status': 'inactive'},
|
|
208
|
-
where={'last_login':
|
|
208
|
+
where={'<last_login': '2023-01-01'}
|
|
209
209
|
)
|
|
210
210
|
```
|
|
211
211
|
|
|
@@ -268,33 +268,47 @@ def get_user_with_profile(tx):
|
|
|
268
268
|
|
|
269
269
|
# Automatic join via foreign key
|
|
270
270
|
users_with_profiles = users.select(
|
|
271
|
-
columns=['name', 'email', '
|
|
271
|
+
columns=['name', 'email', 'profile_id>bio', 'profile_id>avatar_url'],
|
|
272
272
|
where={'status': 'active'}
|
|
273
273
|
).all()
|
|
274
274
|
```
|
|
275
275
|
|
|
276
276
|
#### Complex Conditions
|
|
277
277
|
|
|
278
|
+
Velocity.DB supports various where clause formats:
|
|
279
|
+
|
|
278
280
|
```python
|
|
279
281
|
@engine.transaction
|
|
280
282
|
def complex_queries(tx):
|
|
281
283
|
users = tx.table('users')
|
|
282
284
|
|
|
283
|
-
#
|
|
285
|
+
# Dictionary format with operator prefixes
|
|
284
286
|
results = users.select(where={
|
|
285
|
-
'status': 'active',
|
|
286
|
-
'created_at':
|
|
287
|
-
'age':
|
|
288
|
-
'email':
|
|
287
|
+
'status': 'active', # Equals (default)
|
|
288
|
+
'>=created_at': '2023-01-01', # Greater than or equal
|
|
289
|
+
'><age': [18, 65], # Between
|
|
290
|
+
'%email': '@company.com', # Like
|
|
291
|
+
'!status': 'deleted' # Not equal
|
|
289
292
|
}).all()
|
|
290
293
|
|
|
291
|
-
#
|
|
292
|
-
results = users.select(where=
|
|
293
|
-
'
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
# List of tuples format for complex predicates
|
|
295
|
+
results = users.select(where=[
|
|
296
|
+
('status = %s', 'active'),
|
|
297
|
+
('priority = %s OR urgency = %s', ('high', 'critical'))
|
|
298
|
+
]).all()
|
|
299
|
+
|
|
300
|
+
# Raw string format
|
|
301
|
+
results = users.select(where="status = 'active' AND age >= 18").all()
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Available Operators:**
|
|
305
|
+
- `=` (default): `{'name': 'John'}`
|
|
306
|
+
- `>`, `<`, `>=`, `<=`: `{'>age': 18}`, `{'<=score': 100}`
|
|
307
|
+
- `!`, `!=`, `<>`: `{'!status': 'deleted'}`
|
|
308
|
+
- `%`, `LIKE`: `{'%email': '@company.com'}`
|
|
309
|
+
- `!%`, `NOT LIKE`: `{'!%name': 'test%'}`
|
|
310
|
+
- `><`, `BETWEEN`: `{'><age': [18, 65]}`
|
|
311
|
+
- `!><`, `NOT BETWEEN`: `{'!><score': [0, 50]}`
|
|
298
312
|
```
|
|
299
313
|
|
|
300
314
|
#### Aggregations and Grouping
|
|
@@ -306,7 +320,7 @@ def analytics(tx):
|
|
|
306
320
|
|
|
307
321
|
# Count records
|
|
308
322
|
total_orders = orders.count()
|
|
309
|
-
recent_orders = orders.count(where={'created_at':
|
|
323
|
+
recent_orders = orders.count(where={'>=created_at': '2023-01-01'})
|
|
310
324
|
|
|
311
325
|
# Aggregations
|
|
312
326
|
stats = orders.select(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
velocity/__init__.py,sha256=
|
|
1
|
+
velocity/__init__.py,sha256=SXXkM3wd93I5MId7dRstfGcdJMM5OWzxrAlf4r1Smh0,106
|
|
2
2
|
velocity/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
velocity/app/invoices.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
velocity/app/orders.py,sha256=W-HAXEwY8-IFXbKh82HnMeRVZM7P-TWGEQOWtkLIzI4,6298
|
|
@@ -47,8 +47,8 @@ velocity/misc/tools.py,sha256=_bGneHHA_BV-kUonzw5H3hdJ5AOJRCKfzhgpkFbGqIo,1502
|
|
|
47
47
|
velocity/misc/conv/__init__.py,sha256=MLYF58QHjzfDSxb1rdnmLnuEQCa3gnhzzZ30CwZVvQo,40
|
|
48
48
|
velocity/misc/conv/iconv.py,sha256=d4_BucW8HTIkGNurJ7GWrtuptqUf-9t79ObzjJ5N76U,10603
|
|
49
49
|
velocity/misc/conv/oconv.py,sha256=h5Lo05DqOQnxoD3y6Px_MQP_V-pBbWf8Hkgkb9Xp1jk,6032
|
|
50
|
-
velocity_python-0.0.
|
|
51
|
-
velocity_python-0.0.
|
|
52
|
-
velocity_python-0.0.
|
|
53
|
-
velocity_python-0.0.
|
|
54
|
-
velocity_python-0.0.
|
|
50
|
+
velocity_python-0.0.93.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
|
|
51
|
+
velocity_python-0.0.93.dist-info/METADATA,sha256=7jiOZpb90Inx1hJFYZ_snU4tnF2Wk13_f2s95SbDhw8,10634
|
|
52
|
+
velocity_python-0.0.93.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
velocity_python-0.0.93.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
|
|
54
|
+
velocity_python-0.0.93.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|