Skip to content

Commit

Permalink
update: update records in main
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Jun 4, 2024
1 parent f0a2173 commit c9d2c1a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cache_manager/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _typeof(value: Any):

if isinstance(value, float) or _misc.is_int(value):
return "INT"

elif isinstance(value, float) or _misc.is_float(value):
return "FLOAT"

Expand Down Expand Up @@ -368,11 +368,8 @@ def update(
)
ids = [it.id for it in items()]
_log(f'Updating {len(ids)} items')

where = f'WHERE id IN ({", ".join(ids)})'

q = f'UPDATE main SET ({main}) {where}'

where = f'WHERE id IN ({", ".join(map(str, ids))})'
q = f'UPDATE main SET ({main}) {where};'
self._execute(q)

for actual_typ in ATTR_TYPES:
Expand All @@ -381,7 +378,7 @@ def update(

main = ', '.join(
f'{k} = {self._quotes(v, main_fields[k])}'
for k, v in update.items() if k not in main_fields and
for k, v in update.items() if k not in main_fields and
)
ids = [it.id for it in items()]
_log(f'Updating {len(ids)} items')
Expand Down

0 comments on commit c9d2c1a

Please sign in to comment.