Skip to content

Commit

Permalink
update supabase with default r_value and fire_prob
Browse files Browse the repository at this point in the history
  • Loading branch information
Fruittips committed Nov 27, 2023
1 parent 3a0d580 commit 8649aab
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions lambda/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ def lambda_handler(event, context):

# if less than 25 records, dont calculate r value and return default fire probability
else:
try:
supabase.table('firecloud') \
.update({
"r_value": r_value,
"fire_probability": fire_probability,
}) \
.eq('id', rowId) \
.execute()
except Exception as e:
print(f"Error updating row in supabase: {e}")



return json.dumps({
'statusCode': 200,
'body': json.dumps({
Expand All @@ -56,13 +69,13 @@ def lambda_handler(event, context):

# TODO: update row in supabase table with r_value and fire_probability
try:
data, count = supabase.table('firecloud') \
.update({
"r_value": r_value,
"fire_probability": fire_probability,
}) \
.eq('id', rowId) \
.execute()
supabase.table('firecloud') \
.update({
"r_value": r_value,
"fire_probability": fire_probability,
}) \
.eq('id', rowId) \
.execute()
except Exception as e:
print(f"Error updating row in supabase: {e}")

Expand Down

0 comments on commit 8649aab

Please sign in to comment.