Skip to content

Commit

Permalink
Merge pull request #1340 from glogiotatidis/issue-1285-stop-pulling-d…
Browse files Browse the repository at this point in the history
…ata-redshift

[Fix #1285] Stop pulling data from RedShift.
  • Loading branch information
glogiotatidis committed Mar 24, 2020
2 parents df6b726 + 79774ff commit 5dfb7f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
17 changes: 6 additions & 11 deletions snippets/base/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@


REDASH_QUERY_IDS = {
'redshift-job': 68135,
'bq-job': 68136,
'redshift-impressions': 68345,
'bq-impressions': 68341,

# Not currently used but kept here for reference.
'redshift-job': 68135,
'redshift-impressions': 68345,
}

redash = RedashDynamicQuery(
Expand Down Expand Up @@ -145,10 +147,7 @@ def prosses_rows(rows, key='message_id'):


def update_job_metrics(date):
rows = []
for query in ['redshift-job', 'bq-job']:
rows += redash_rows(query, date)

rows = redash_rows('bq-job', date)
processed = prosses_rows(rows, key='message_id')
with atomic():
JobDailyPerformance.objects.filter(date=date).delete()
Expand All @@ -162,11 +161,7 @@ def update_job_metrics(date):


def update_impressions(date):
rows = []

for query in ['redshift-impressions', 'bq-impressions']:
rows += redash_rows(query, date)

rows = redash_rows('bq-impressions', date)
details = []
for row in rows:
# Normalize channel name, based on what kind of snippets they get.
Expand Down
6 changes: 1 addition & 5 deletions snippets/base/tests/test_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def test_base(self):
'channel': 'demo',
'country_code': 'GR',
'counts': 5,
}
],
[
},
{
'message_id': '1000',
'event_context': '',
Expand Down Expand Up @@ -225,8 +223,6 @@ def test_base(self):
'counts': 10,
'duration': '5',
},
],
[
{
'channel': 'release',
'counts': 2,
Expand Down

0 comments on commit 5dfb7f7

Please sign in to comment.