diff --git a/api/datalake_api/querier.py b/api/datalake_api/querier.py index a9c1a80..7091ba9 100644 --- a/api/datalake_api/querier.py +++ b/api/datalake_api/querier.py @@ -178,7 +178,8 @@ def __init__(self, table_name, latest_table_name=None, dynamodb=None): self.table_name = table_name self.latest_table_name = latest_table_name self.dynamodb = dynamodb - self.use_latest = os.environ.get("DATALAKE_USE_LATEST_TABLE", False) + self.use_latest_table = os.environ.get("DATALAKE_USE_LATEST_TABLE", + False) def query_by_work_id(self, work_id, what, where=None, cursor=None): kwargs = self._prepare_work_id_kwargs(work_id, what) @@ -340,7 +341,7 @@ def _latest_table(self): return self.dynamodb.Table(self.latest_table_name) def query_latest(self, what, where, lookback_days=DEFAULT_LOOKBACK_DAYS): - if self.use_latest: + if self.use_latest_table: response = self._latest_table.query( KeyConditionExpression=Key('what_where_key').eq(f'{what}:{where}') ) diff --git a/api/tests/test_archive_querier.py b/api/tests/test_archive_querier.py index 8f689fa..5e00114 100644 --- a/api/tests/test_archive_querier.py +++ b/api/tests/test_archive_querier.py @@ -549,6 +549,6 @@ def test_latest_table_query(table_maker, querier, record_maker): what='boo', where='hoo{}'.format(i)) table_maker(records) - querier.use_latest = True + querier.use_latest_table = True result = querier.query_latest('boo', 'hoo0') _validate_latest_result(result, what='boo', where='hoo0') \ No newline at end of file diff --git a/ingester/datalake_ingester/storage.py b/ingester/datalake_ingester/storage.py index f6aab0b..31b3f4d 100644 --- a/ingester/datalake_ingester/storage.py +++ b/ingester/datalake_ingester/storage.py @@ -29,7 +29,7 @@ def __init__(self, table_name=None, latest_table=None, connection=None): self.table_name = table_name self.latest_table_name = os.environ.get("DATALAKE_DNAMODB_LATEST_TABLE", f"{latest_table}") - self.use_latest = os.environ.get("DATALAKE_USE_LATEST_TABLE", False) + self.use_latest_table = os.environ.get("DATALAKE_USE_LATEST_TABLE", False) self._prepare_connection(connection) self.logger = logging.getLogger('storage')