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

Fix No Feedback Defaults to 0 Score (Negative Feedback) in Snowflake #304

Merged
merged 7 commits into from
Mar 1, 2024
Merged
5 changes: 3 additions & 2 deletions airflow/dags/metrcis/load_firestore_to_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import time
from datetime import date, datetime, timedelta
from typing import Optional
davidgxue marked this conversation as resolved.
Show resolved Hide resolved

import snowflake.connector
from google.cloud import firestore
Expand Down Expand Up @@ -54,11 +55,11 @@ def load_request_data_from_firestore() -> list[tuple[str, int, bool, int]]:
.stream()
)

rows: list[tuple[str, int, bool, int]] = []
rows: list[tuple[str, Optional[int], bool, datetime]] = []
davidgxue marked this conversation as resolved.
Show resolved Hide resolved
for doc in docs:
doc_dict = doc.to_dict()
uuid = doc_dict["uuid"]
score = doc_dict.get("score") or 0
score = doc_dict.get("score")
status = doc_dict.get("status") == "complete"
response_received_at = datetime.fromtimestamp(doc_dict.get("response_received_at"))
rows.append((uuid, score, status, response_received_at))
Expand Down
Loading