Permalink
Browse files

feat(scripts): delete flow.begin events after processing

  • Loading branch information...
philbooth committed Aug 28, 2018
1 parent 2e5b270 commit 4576a7d3ec6165d9b315a2e9563071c91317250e
Showing with 7 additions and 0 deletions.
  1. +7 −0 import_flow_events.py
@@ -148,6 +148,12 @@
AND type = 'flow.begin';
"""

Q_DELETE_BEGIN_EVENTS = """
DELETE FROM {table_name}
WHERE timestamp::DATE <= '{day}'
AND type = 'flow.begin';
"""

Q_UPDATE_METADATA = """
UPDATE flow_metadata{suffix}
SET
@@ -324,6 +330,7 @@ def after_day(db, day, temporary_table_name, permanent_table_name, sample_rates)
day=day,
table_name=temporary_table_name,
percent=rate["percent"]))
db.run(Q_DELETE_BEGIN_EVENTS.format(table_name=table_name, day=day))
print " UPDATING"
db.run(Q_UPDATE_METADATA.format(suffix=rate["suffix"],
table_name=table_name,

0 comments on commit 4576a7d

Please sign in to comment.