lumera 0.9.0__tar.gz → 0.9.1__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.
- {lumera-0.9.0 → lumera-0.9.1}/PKG-INFO +1 -1
- {lumera-0.9.0 → lumera-0.9.1}/lumera/pb.py +63 -11
- {lumera-0.9.0 → lumera-0.9.1}/lumera/sdk.py +28 -4
- {lumera-0.9.0 → lumera-0.9.1}/lumera.egg-info/PKG-INFO +1 -1
- {lumera-0.9.0 → lumera-0.9.1}/pyproject.toml +1 -1
- {lumera-0.9.0 → lumera-0.9.1}/lumera/__init__.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/_utils.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/automations.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/exceptions.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/google.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/llm.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/locks.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/storage.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera/webhooks.py +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera.egg-info/SOURCES.txt +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera.egg-info/dependency_links.txt +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera.egg-info/requires.txt +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/lumera.egg-info/top_level.txt +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/setup.cfg +0 -0
- {lumera-0.9.0 → lumera-0.9.1}/tests/test_sdk.py +0 -0
|
@@ -318,31 +318,44 @@ def delete(collection: str, record_id: str) -> None:
|
|
|
318
318
|
# =============================================================================
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
def bulk_delete(
|
|
321
|
+
def bulk_delete(
|
|
322
|
+
collection: str,
|
|
323
|
+
record_ids: Sequence[str],
|
|
324
|
+
*,
|
|
325
|
+
transaction: bool = False,
|
|
326
|
+
) -> dict[str, Any]:
|
|
322
327
|
"""Delete multiple records by ID.
|
|
323
328
|
|
|
324
329
|
Args:
|
|
325
330
|
collection: Collection name or ID
|
|
326
331
|
record_ids: List of record IDs to delete (max 1000)
|
|
332
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure).
|
|
333
|
+
If False (default), partial success is allowed.
|
|
327
334
|
|
|
328
335
|
Returns:
|
|
329
336
|
Result with succeeded/failed counts and any errors:
|
|
330
337
|
{
|
|
331
338
|
"succeeded": 10,
|
|
332
339
|
"failed": 0,
|
|
333
|
-
"errors": []
|
|
340
|
+
"errors": [],
|
|
341
|
+
"rolled_back": false # only present if transaction=True and failed
|
|
334
342
|
}
|
|
335
343
|
|
|
336
344
|
Example:
|
|
337
345
|
>>> result = pb.bulk_delete("deposits", ["id1", "id2", "id3"])
|
|
338
346
|
>>> print(f"Deleted {result['succeeded']} records")
|
|
347
|
+
|
|
348
|
+
>>> # Use transaction mode for all-or-nothing
|
|
349
|
+
>>> result = pb.bulk_delete("deposits", ids, transaction=True)
|
|
339
350
|
"""
|
|
340
|
-
return _bulk_delete_records(collection, record_ids)
|
|
351
|
+
return _bulk_delete_records(collection, record_ids, transaction=transaction)
|
|
341
352
|
|
|
342
353
|
|
|
343
354
|
def bulk_update(
|
|
344
355
|
collection: str,
|
|
345
356
|
records: Sequence[dict[str, Any]],
|
|
357
|
+
*,
|
|
358
|
+
transaction: bool = False,
|
|
346
359
|
) -> dict[str, Any]:
|
|
347
360
|
"""Update multiple records with individual data per record.
|
|
348
361
|
|
|
@@ -352,9 +365,17 @@ def bulk_update(
|
|
|
352
365
|
Args:
|
|
353
366
|
collection: Collection name or ID
|
|
354
367
|
records: List of records to update (max 1000). Each must have 'id' field.
|
|
368
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure).
|
|
369
|
+
If False (default), partial success is allowed.
|
|
355
370
|
|
|
356
371
|
Returns:
|
|
357
|
-
Result with succeeded/failed counts
|
|
372
|
+
Result with succeeded/failed counts:
|
|
373
|
+
{
|
|
374
|
+
"succeeded": 2,
|
|
375
|
+
"failed": 0,
|
|
376
|
+
"errors": [],
|
|
377
|
+
"rolled_back": false # only present if transaction=True and failed
|
|
378
|
+
}
|
|
358
379
|
|
|
359
380
|
Example:
|
|
360
381
|
>>> result = pb.bulk_update("deposits", [
|
|
@@ -362,11 +383,19 @@ def bulk_update(
|
|
|
362
383
|
... {"id": "rec2", "status": "rejected", "amount": 200},
|
|
363
384
|
... ])
|
|
364
385
|
>>> print(f"Updated {result['succeeded']} records")
|
|
386
|
+
|
|
387
|
+
>>> # Use transaction mode for all-or-nothing
|
|
388
|
+
>>> result = pb.bulk_update("deposits", records, transaction=True)
|
|
365
389
|
"""
|
|
366
|
-
return _bulk_update_records(collection, records)
|
|
390
|
+
return _bulk_update_records(collection, records, transaction=transaction)
|
|
367
391
|
|
|
368
392
|
|
|
369
|
-
def bulk_upsert(
|
|
393
|
+
def bulk_upsert(
|
|
394
|
+
collection: str,
|
|
395
|
+
records: Sequence[dict[str, Any]],
|
|
396
|
+
*,
|
|
397
|
+
transaction: bool = False,
|
|
398
|
+
) -> dict[str, Any]:
|
|
370
399
|
"""Create or update multiple records by ID.
|
|
371
400
|
|
|
372
401
|
Each record can include an "id" field. Records with matching IDs will be
|
|
@@ -375,25 +404,44 @@ def bulk_upsert(collection: str, records: Sequence[dict[str, Any]]) -> dict[str,
|
|
|
375
404
|
Args:
|
|
376
405
|
collection: Collection name or ID
|
|
377
406
|
records: List of records (max 1000)
|
|
407
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure).
|
|
408
|
+
If False (default), partial success is allowed.
|
|
378
409
|
|
|
379
410
|
Returns:
|
|
380
|
-
Result with succeeded/failed counts and created record IDs
|
|
411
|
+
Result with succeeded/failed counts and created record IDs:
|
|
412
|
+
{
|
|
413
|
+
"succeeded": 2,
|
|
414
|
+
"failed": 0,
|
|
415
|
+
"errors": [],
|
|
416
|
+
"records": [{"id": "..."}, ...],
|
|
417
|
+
"rolled_back": false # only present if transaction=True and failed
|
|
418
|
+
}
|
|
381
419
|
|
|
382
420
|
Example:
|
|
383
421
|
>>> result = pb.bulk_upsert("deposits", [
|
|
384
422
|
... {"id": "existing_id", "amount": 100},
|
|
385
423
|
... {"amount": 200}, # creates new record
|
|
386
424
|
... ])
|
|
425
|
+
|
|
426
|
+
>>> # Use transaction mode for all-or-nothing
|
|
427
|
+
>>> result = pb.bulk_upsert("deposits", records, transaction=True)
|
|
387
428
|
"""
|
|
388
|
-
return _bulk_upsert_records(collection, records)
|
|
429
|
+
return _bulk_upsert_records(collection, records, transaction=transaction)
|
|
389
430
|
|
|
390
431
|
|
|
391
|
-
def bulk_insert(
|
|
432
|
+
def bulk_insert(
|
|
433
|
+
collection: str,
|
|
434
|
+
records: Sequence[dict[str, Any]],
|
|
435
|
+
*,
|
|
436
|
+
transaction: bool = False,
|
|
437
|
+
) -> dict[str, Any]:
|
|
392
438
|
"""Insert multiple new records.
|
|
393
439
|
|
|
394
440
|
Args:
|
|
395
441
|
collection: Collection name or ID
|
|
396
442
|
records: List of records to create (max 1000)
|
|
443
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure).
|
|
444
|
+
If False (default), partial success is allowed.
|
|
397
445
|
|
|
398
446
|
Returns:
|
|
399
447
|
Result with succeeded/failed counts and created record IDs:
|
|
@@ -401,7 +449,8 @@ def bulk_insert(collection: str, records: Sequence[dict[str, Any]]) -> dict[str,
|
|
|
401
449
|
"succeeded": 2,
|
|
402
450
|
"failed": 0,
|
|
403
451
|
"errors": [],
|
|
404
|
-
"records": [{"id": "..."}, {"id": "..."}]
|
|
452
|
+
"records": [{"id": "..."}, {"id": "..."}],
|
|
453
|
+
"rolled_back": false # only present if transaction=True and failed
|
|
405
454
|
}
|
|
406
455
|
|
|
407
456
|
Example:
|
|
@@ -411,8 +460,11 @@ def bulk_insert(collection: str, records: Sequence[dict[str, Any]]) -> dict[str,
|
|
|
411
460
|
... ])
|
|
412
461
|
>>> for rec in result["records"]:
|
|
413
462
|
... print(f"Created: {rec['id']}")
|
|
463
|
+
|
|
464
|
+
>>> # Use transaction mode for all-or-nothing
|
|
465
|
+
>>> result = pb.bulk_insert("deposits", records, transaction=True)
|
|
414
466
|
"""
|
|
415
|
-
return _bulk_insert_records(collection, records)
|
|
467
|
+
return _bulk_insert_records(collection, records, transaction=transaction)
|
|
416
468
|
|
|
417
469
|
|
|
418
470
|
def iter_all(
|
|
@@ -591,12 +591,15 @@ def delete_record(collection_id_or_name: str, record_id: str) -> None:
|
|
|
591
591
|
def bulk_delete_records(
|
|
592
592
|
collection_id_or_name: str,
|
|
593
593
|
record_ids: Sequence[str],
|
|
594
|
+
*,
|
|
595
|
+
transaction: bool = False,
|
|
594
596
|
) -> dict[str, Any]:
|
|
595
597
|
"""Bulk delete records by IDs.
|
|
596
598
|
|
|
597
599
|
Args:
|
|
598
600
|
collection_id_or_name: Collection name or ID
|
|
599
601
|
record_ids: List of record IDs to delete (max 1000)
|
|
602
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure)
|
|
600
603
|
|
|
601
604
|
Returns:
|
|
602
605
|
Result with succeeded/failed counts and any errors
|
|
@@ -607,19 +610,25 @@ def bulk_delete_records(
|
|
|
607
610
|
raise ValueError("record_ids is required")
|
|
608
611
|
|
|
609
612
|
path = f"collections/{collection_id_or_name}/records/bulk/delete"
|
|
610
|
-
|
|
613
|
+
body: dict[str, Any] = {"ids": list(record_ids)}
|
|
614
|
+
if transaction:
|
|
615
|
+
body["transaction"] = True
|
|
616
|
+
result = _api_request("POST", path, json_body=body)
|
|
611
617
|
return result if isinstance(result, dict) else {}
|
|
612
618
|
|
|
613
619
|
|
|
614
620
|
def bulk_update_records(
|
|
615
621
|
collection_id_or_name: str,
|
|
616
622
|
records: Sequence[Mapping[str, Any]],
|
|
623
|
+
*,
|
|
624
|
+
transaction: bool = False,
|
|
617
625
|
) -> dict[str, Any]:
|
|
618
626
|
"""Update multiple records with individual data per record.
|
|
619
627
|
|
|
620
628
|
Args:
|
|
621
629
|
collection_id_or_name: Collection name or ID
|
|
622
630
|
records: List of records to update (max 1000). Each record must have an 'id' field.
|
|
631
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure)
|
|
623
632
|
|
|
624
633
|
Returns:
|
|
625
634
|
Result with succeeded/failed counts
|
|
@@ -630,19 +639,25 @@ def bulk_update_records(
|
|
|
630
639
|
raise ValueError("records is required")
|
|
631
640
|
|
|
632
641
|
path = f"collections/{collection_id_or_name}/records/bulk/update"
|
|
633
|
-
|
|
642
|
+
body: dict[str, Any] = {"records": [dict(r) for r in records]}
|
|
643
|
+
if transaction:
|
|
644
|
+
body["transaction"] = True
|
|
645
|
+
result = _api_request("POST", path, json_body=body)
|
|
634
646
|
return result if isinstance(result, dict) else {}
|
|
635
647
|
|
|
636
648
|
|
|
637
649
|
def bulk_upsert_records(
|
|
638
650
|
collection_id_or_name: str,
|
|
639
651
|
records: Sequence[Mapping[str, Any]],
|
|
652
|
+
*,
|
|
653
|
+
transaction: bool = False,
|
|
640
654
|
) -> dict[str, Any]:
|
|
641
655
|
"""Upsert multiple records (create or update by ID).
|
|
642
656
|
|
|
643
657
|
Args:
|
|
644
658
|
collection_id_or_name: Collection name or ID
|
|
645
659
|
records: List of records (max 1000). Include 'id' field to update existing.
|
|
660
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure)
|
|
646
661
|
|
|
647
662
|
Returns:
|
|
648
663
|
Result with succeeded/failed counts and created record IDs
|
|
@@ -653,19 +668,25 @@ def bulk_upsert_records(
|
|
|
653
668
|
raise ValueError("records is required")
|
|
654
669
|
|
|
655
670
|
path = f"collections/{collection_id_or_name}/records/bulk/upsert"
|
|
656
|
-
|
|
671
|
+
body: dict[str, Any] = {"records": [dict(r) for r in records]}
|
|
672
|
+
if transaction:
|
|
673
|
+
body["transaction"] = True
|
|
674
|
+
result = _api_request("POST", path, json_body=body)
|
|
657
675
|
return result if isinstance(result, dict) else {}
|
|
658
676
|
|
|
659
677
|
|
|
660
678
|
def bulk_insert_records(
|
|
661
679
|
collection_id_or_name: str,
|
|
662
680
|
records: Sequence[Mapping[str, Any]],
|
|
681
|
+
*,
|
|
682
|
+
transaction: bool = False,
|
|
663
683
|
) -> dict[str, Any]:
|
|
664
684
|
"""Insert multiple new records.
|
|
665
685
|
|
|
666
686
|
Args:
|
|
667
687
|
collection_id_or_name: Collection name or ID
|
|
668
688
|
records: List of records to create (max 1000)
|
|
689
|
+
transaction: If True, use all-or-nothing semantics (rollback on any failure)
|
|
669
690
|
|
|
670
691
|
Returns:
|
|
671
692
|
Result with succeeded/failed counts and created record IDs
|
|
@@ -676,7 +697,10 @@ def bulk_insert_records(
|
|
|
676
697
|
raise ValueError("records is required")
|
|
677
698
|
|
|
678
699
|
path = f"collections/{collection_id_or_name}/records/bulk/insert"
|
|
679
|
-
|
|
700
|
+
body: dict[str, Any] = {"records": [dict(r) for r in records]}
|
|
701
|
+
if transaction:
|
|
702
|
+
body["transaction"] = True
|
|
703
|
+
result = _api_request("POST", path, json_body=body)
|
|
680
704
|
return result if isinstance(result, dict) else {}
|
|
681
705
|
|
|
682
706
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|