db_tools
bulk_upsert_image_cache_fast(*, list_upsert_objects, db)
¶
Insert or update many objects into HistoryImageCache and commit
This function is an optimized version of
for obj in list_upsert_objects:
db.merge(**obj)
db.commit()
See docs at https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#insert-on-conflict-upsert
NOTE: we tried to replace index_elements with
constraint="pk_historyimagecache", but it did not work as expected.
| PARAMETER | DESCRIPTION |
|---|---|
list_upsert_objects
|
List of dictionaries for objects to be upsert-ed.
TYPE:
|
db
|
A sync database session
TYPE:
|
Source code in fractal_server/runner/v2/db_tools.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |