Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds current timestamp to lastPulled property of data responses #326

Merged
merged 2 commits into from
Mar 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions server/src/services/dataService.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down