-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.py
More file actions
19 lines (14 loc) · 840 Bytes
/
db.py
File metadata and controls
19 lines (14 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from sheet_utils import append_to_sheet, update_to_sheet, SHEET_NAME
def db_set(ts, event_type, username, latitude, longitude, horizontal_accuracy, source=None):
values = [ts, event_type, username, latitude, longitude, horizontal_accuracy, source]
result = append_to_sheet(values)
return result
def db_update(column, row, data):
range_to_update = f"{SHEET_NAME}!{column}{row}"
result = update_to_sheet(range_to_update, [data])
return result
def db_update_batch(column_start, row, column_end, ts, event_type, username, latitude, longitude, horizontal_accuracy, source=None):
range_to_update = f"{SHEET_NAME}!{column_start}{row}:{column_end}{row}"
values = [ts, event_type, username, latitude, longitude, horizontal_accuracy, source]
result = update_to_sheet(range_to_update, values)
return result