Skip to content

Commit

Permalink
fix: add month partition column (#103)
Browse files Browse the repository at this point in the history
Add the `month` partition column to the data exported for each ticket.
  • Loading branch information
patheard authored Jan 16, 2025
1 parent a4befbe commit bf73030
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion export/platform/support/freshdesk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def get_tickets(self):
"source_label": SOURCE_LOOKUP.get(source_num, "Unknown"),
"created_at": ticket.get("created_at"),
"updated_at": ticket.get("updated_at"),
"month": yesterday.strftime("%Y-%m"),
"due_by": ticket.get("due_by"),
"fr_due_by": ticket.get("fr_due_by"),
"is_escalated": ticket.get("is_escalated"),
Expand Down Expand Up @@ -213,7 +214,7 @@ def upload_to_s3(bucket, prefix, data):
yesterday = datetime.now() - timedelta(days=1)
day = yesterday.strftime("%Y-%m-%d")
month = yesterday.strftime("%Y-%m")
key = f"{prefix}/MONTH={month}/{day}.json"
key = f"{prefix}/month={month}/{day}.json"

s3_client.put_object(
Bucket=bucket, Key=key, Body=json.dumps(data, ensure_ascii=False)
Expand Down
1 change: 1 addition & 0 deletions export/platform/support/freshdesk/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"source": 1,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T12:00:00Z",
"month": "2024-01",
"due_by": "2024-01-02T00:00:00Z",
"fr_due_by": "2024-01-02T00:00:00Z",
"is_escalated": False,
Expand Down

0 comments on commit bf73030

Please sign in to comment.