From aec092df8d86778ba2293030b2ef49f8ae279368 Mon Sep 17 00:00:00 2001 From: sellnat77 Date: Sun, 1 Mar 2020 12:14:08 -0800 Subject: [PATCH] Adds current timestamp to lastPulled property of data responses --- server/src/services/dataService.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/src/services/dataService.py b/server/src/services/dataService.py index 11b22d998..ddf364e4b 100644 --- a/server/src/services/dataService.py +++ b/server/src/services/dataService.py @@ -1,18 +1,22 @@ -import sqlalchemy as db +import datetime import pandas as pd +import sqlalchemy as db class DataService(object): def includeMeta(func): - def inner1(*args, **kwargs): + def innerFunc(*args, **kwargs): dataResponse = func(*args, **kwargs) if 'Error' in dataResponse: return dataResponse - withMeta = {'lastPulled': 'NOW', 'data': dataResponse} + # Will represent last time the ingest pipeline ran + lastPulledTimestamp = datetime.datetime.utcnow() + withMeta = {'lastPulled': lastPulledTimestamp, + 'data': dataResponse} return withMeta - return inner1 + return innerFunc def __init__(self, config=None, tableName="ingest_staging_table"): self.config = config