Skip to content

Commit

Permalink
Added log message in Cache.update
Browse files Browse the repository at this point in the history
  • Loading branch information
npalacioescat committed Jun 4, 2024
1 parent 7d738e2 commit ea0f923
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cache_manager/_cache.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
from __future__ import annotations
from typing import Any

from typing import Any
import os
import sqlite3
import datetime

from pypath_common import _misc
from cache_manager._session import _log

from cache_manager._item import CacheItem
from cache_manager._session import _log
import cache_manager.utils as _utils
from . import _data

__all__ = [
'ATTR_TYPES',
'Cache',
]

ATTR_TYPES = ['varchar', 'int', 'date', 'float']


Expand Down Expand Up @@ -77,7 +81,7 @@ def _create_schema(self):

_log(f'Initializing database')

fields = ",".join(f'{k}: {v}' for k, v in self._table_fields().items())
fields = ','.join(f'{k}: {v}' for k, v in self._table_fields().items())

_log(f'Ensuring main table exists')
self._execute(f'''
Expand Down Expand Up @@ -112,10 +116,10 @@ def _quotes(string: str, typ: str = 'VARCHAR') -> str:
def _typeof(value: Any):

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

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


@staticmethod
Expand Down Expand Up @@ -397,3 +401,5 @@ def update(
q = f'UPDATE attr_{actual_typ} SET ({values}) {where}'

self._execute(q)

_log(f'Finished updating attributes')

0 comments on commit ea0f923

Please sign in to comment.