Skip to content

Commit

Permalink
Merge pull request #326 from hackforla/325_BACK_lastPulled
Browse files Browse the repository at this point in the history
Adds current timestamp to lastPulled property of data responses
  • Loading branch information
sellnat77 authored Mar 1, 2020
2 parents 455e75d + ef18a15 commit 2abd169
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 2abd169

Please sign in to comment.